eSeGeCe
software
TsgcWebSocketClient is the .NET wrapper around the sgcWebSockets runtime client. It inherits all core WebSocket capabilities from TsgcWebSocketClient_base, giving .NET applications a component-style API for connecting, sending, and receiving over WebSockets
true to connect, false to disconnectRegister event handlers to react to connection lifecycle and data:
using esegece.sgcWebSockets;
var client = new TsgcWebSocketClient();
client.OnConnect += OnConnectEvent;
client.OnDisconnect += OnDisconnectEvent;
client.OnException += OnExceptionEvent;
client.OnError += OnErrorEvent;
client.OnMessage += OnMessageEvent;
client.Host = "www.esegece.com";
client.Port = 2052;
client.Options.Parameters = "/";
client.TLS = false;
client.Specifications.RFC6455 = true;
client.Active = true;
// Sending data once connected
client.WriteData("Hello WebSocket!");
This snippet mirrors the demo usage: events are wired up before connecting, key properties are configured (host, port, TLS, RFC6455, etc.), and setting Active to true initiates the connection.
With the event handlers defined (as shown above), the client can log connections, receive messages, and send data through WriteData.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.