I'm playing around with websockets using socket.io. I've made a chat room, but I want to make a real time game. The socket.io docs say that any data type can be sent over websockets, so I'm wondering what the most efficient data type would be for sending data like player position, velocity, and keypress information.
In other words, in games like agar.io and whatnot, what type of data is really being sent between the client and server? Is it binary, json, etc.?
If you are coding in JavaScript
just use JSON
you will have to convert it back anyways otherwise. If there is some bigger data like pictures you can think about streaming it, have a look at https://www.npmjs.com/package/socket.io-stream.