I am trying to send a message from my Windows Store (C#) app to a Socket.IO server, but the replies I get from the server are random ID codes ranging from 55 to 100someting followed by the websocket getting a code: "1000" (Connection Closed).
I've looked up the documentation of the Socket.IO protocol (https://github.com/automattic/socket.io-protocol), but it is not giving any raw examples so I am stuck. All C# based projects for communicating with Socket.IO is deprecated as they are based on 0.9x versions and 1.0 changed a lot of stuff. Instead of 9 different message types, we are down to 7, and a message is sent as an event, regardless of content with the exception of binary.
Here is the code I use to transmit messages (Connetion logic and such removed):
var _msgWebSocket = new MessageWebSocket();
_msgWebSocket.Control.MessageType = SocketMessageType.Utf8;
_msgWebSocket.SetRequestHeader("Cookie", cookieHeader);
await _msgWebSocket.ConnectAsync(new Uri(websocketUri));
var _msgWriter = new DataWriter(_msgWebSocket.OutputStream);
_msgWriter.UnicodeEncoding = UnicodeEncoding.Utf8;
var packet = string.Format("{0}:\"{1}\":[\"{2}\", {3}]", (int)MessageType.Event, "/", "chat", jsonString);
_msgWriter.WriteString(packet);
var result = await _msgWriter.StoreAsync();
Debug.WriteLine(result.ToString());
The raw string would then be: '2:"\":["chat", {"Recipient":"GUID","Message":"Hello World"}]' and this is not correct, but I have no idea how the raw packets in Socket.IO look like.
The Json received when chatting between users on the site looks like this (From Microsoft Network Capture):
I believe the JavaScript for Socket.IO to send a message would be: socket.Emit("chat", JsonData)
So, could anyone please give me some examples of RAW packets sent from a client to the server for events? I'll be able to piece together what I need from that (I hope). It would also be extremely helpful with RAW packet examples of ACK / Heartbeats also.