TsgcWebSocketServer › 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. The Connection parameter identifies the new session and exposes its Guid, PeerIP, protocol, authentication state, and custom tag. For plain TCP connections the event is only fired after the first message is received (or after OnUnknownProtocol accepts the protocol); use OnTCPConnect instead if you need to be notified the moment the TCP socket is accepted.
void OnConnect(TsgcWSConnection Connection)
{
Console.WriteLine("Client connected: " + Connection.Guid + " from " + Connection.PeerIP);
}