I try to emit event "player move" with a json-object:
this.broadcast.emit("player move", JSON.stringify(player)); but on the client I get this:
INFO: > 5:::{"args":[{"x":108,"y":105}],"name":"player move"} Which doesnt show an event. Why is this? (This is from a socket.io framework in JavaScript).
Im using socket.io 0.9.17
EDIT: More code
client.on('player move', onPlayerMove); Then the function:
function onPlayerMove(data) { var player = playerWithId(this.id); if (!player) { util.log("Player not found: " + this.id); return; } player.setX(data.x); player.setY(data.y); this.broadcast.emit("player move", JSON.stringify(player)); }