i found this page Protocols. I'm currently working on a game similar to agario and i find that page is helpful for my game.
They using WebSocket for sending game messages which is mine too. But i'm use text message (JSON) instead of binary message and i'm planning to switch to binary message for minimizing bandwidth reason because JSON are verbose even it's easy to serialize/deserialize.
On the section server->client protocol and client->server protocol, they used term of opcode. I don't about what opcode is and what the purpose of those number, but i know in WebSocket protocol RFC 6455RFC 6455, they used term of opcode too like 1 for text message and 2 for binary message.
My Question is:
How to serialize/deserialize game messages in binary message?
What is those number in opcode used for? for now, my assumption is those number are used for serialization in binary message, maybe not i don't know
If my assumption in Q2 is right, how to implement those number to my protocol? maybe some code demonstration? it will be great if the code in javascript and golang because i'm use go for server and javascript for client.
Thanks