N2O Protocol
JSON container
Each message from Web Socket channel to Client encoded as JSON object. N2O.js is used to decode WebSocket binary messages from JSON container.
{ "eval": "ws.send("Send Back This String");",
"data": [131,104,2,100,0,7,109,101,115,115,
97,103,101,107,0,5,72,101,108,108,111] }
EVAL values evaluated immediately and DATA values passed to handle_web_socket(data) function if exists.
function handle_web_socket(body) { console.log(body); }
BERT messages
Usually in DATA come BERT messages (Binary Erlang Term Format). BERT.js is used to decode Game Protocol message.
function handle_web_socket(body) {
console.log(String(bert.decodebuf(body))); }
E> Received: {message,"Hello"}