TsgcWebSocketServer_HTTPAPI › Events › OnConnect
Fires every time a WebSocket connection is established with a client.
public event TsgcWSConnectEventHandler OnConnect;
// delegate void TsgcWSConnectEventHandler(TsgcWSConnection Connection)
—
OnConnect is raised after the WebSocket handshake with a client has completed successfully and the session is ready to exchange frames over the underlying HTTP.SYS request. The Connection parameter identifies the new session and exposes its Guid, PeerIP, protocol, authentication state, and custom tag. Because the HTTP API server routes every request through the kernel first, plain TCP connections are not handled here; use OnTCPConnect when you need to be notified about the initial socket accept or to treat a client as raw TCP.
void OnConnect(TsgcWSConnection Connection)
{
Console.WriteLine("Client connected: " + Connection.Guid + " from " + Connection.PeerIP);
}