This demo shows how connect to a Socket.IO Server. Requires a TsgcWebSocketClient to handle WebSocket / TCP protocols.
if (socketio == null)
{
socketio = new TsgcWSAPI_SocketIO();
socketio.Client = client;
}
socketio.Client = client;
txtParameters.Text = "/";
chkTLS.Checked = true;
chkOverWebSocket.Checked = true;
txtHost.Text = "socketio-chat-h9jt.herokuapp.com";
txtPort.Text = "443";
txtParameters.Text = "/";
Socket.IO uses TsgcWebSocketClient to send messages to server, so just call WriteData and pass as a parameter the JSON message to socket.io server
client.WriteData("42[\"new message\", \"" + txtSocketIOMessage.Text + "\"]");
The messages received as the flow of connection is handled by TsgcWebSocketClient, so use this component to read the messages sent from server and to know if connection is active or not.
private void OnMessageEvent(TsgcWSConnection Connection, string Text)
{
DoLog(Text);
}