socket: SocketIOClient.Socket;
subscribeToSocket() {
this.socket = io("http://13.232.53.10:3000", {
"transports": ["polling", "websocket"]
});
this.socket.on("sync", (data) => {
console.log("sync event fired, syncing numbers")
if (data.uniqueId != CobrowsingformComponent.uniqueId) {
CobrowsingformComponent.prevSequenceNumberReceived = data.nextSequenceNumber - 10;
}
});
this.socket.on("sync", (data) => {
CobrowsingformComponent.prevSequenceNumberReceived = data.nextSequenceNumber;
})
this.socket.emit("sync", {
nextSequenceNumber: CobrowsingformComponent.mysequenceNumber,
uniqueId: CobrowsingformComponent.uniqueId
})
this.socket.on("connect", (data) => {
console.log("socket connected");
});
this.socket.on("message", (data) => {
this.handleData(data);
});
this.socket.on("info", (message) => {
console.log("some info received");
this.msg.info(message)
});
this.socket.on("fileUpload", (data) => {
const { image, name } = data;
console.log("some file was uploaded by the client");
this.uploadedImages[name] = image;
})
this.socket.on("disconnect", () => {
console.log("socket disconnected");
});
}
Created
June 2, 2020 18:45
-
-
Save codebanesr/2d4be32450aef4fb0f22874273fe8ac0 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment