Skip to content Skip to sidebar Skip to footer

Accessing A Function Stored In An Object On Server-side From Client-side

Server-side: //When a player connects, all the players will get this message. game.sockets.emit('entrance', { id: socket.id, players: [],

Solution 1:

With socket.io, you're sending JSON objects over the wire, and JSON doesn't support the sending of functions: http://www.json.org/

See this post full a detailed approach to do what you're trying to do: Sending anonymous functions through socket.io? (the post talks specifically about anonymous functions, but the same holds true for what you're attempting).

Post a Comment for "Accessing A Function Stored In An Object On Server-side From Client-side"