I've got the problem that the second emit() in the following code (I have picked the important part if there is more needed just ask), which is sending a "stateChange"-Event, seems not to be executed. The "ID"-Event is received by the Server.
this.socket = io.connect('...');
this.socket.emit("ID", {canvasID: this.ID});
this.socket.on(PLACE_BUBBLE, function(data){
var node = uCanvas.placeBubble(data.x1, data.y1);
this.socket.emit("stateChange",
{action : PLACE_BUBBLE, canvasID : this.ID, nodeID : node.nodeID, x : node.x, y : node.y});
});
The server is looking like this:
socketio.sockets.on("connection", function(socket){
socket.on("ID", function(data){
...
});
socket.on("stateChange", function(data){
...
});
});
placeBubble() is executed but there is simply no information send back to the server.
/solved: Problem was "this" in this.socket.emit which should be uCanvas.socket.emit(). This was the object holding the socket.
Solved: Problem was "this" in this.socket.emit which should be uCanvas.socket.emit(). This was the object holding the socket.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.