TsgcWebSocketServer › Events

TsgcWebSocketServer Events

Events you can handle, grouped by purpose, followed by the full alphabetical list.

Lifecycle

NameDescription
OnStartupFires after the server has started and is ready to accept connections.
OnShutdownFires after the server has stopped and no more connections are accepted.
OnTCPConnectFires after a client connects at TCP level and before the WebSocket handshake, so the connection can be accepted or rejected.
OnConnectFires every time a WebSocket connection is established with a client.
OnDisconnectFires every time a WebSocket connection with a client is dropped.
OnHandshakeFires after the handshake is evaluated on the server side and before the response is sent.
OnErrorFires whenever a WebSocket protocol error occurs, such as a mal-formed handshake.
OnExceptionFires whenever an unhandled exception is raised while processing a client connection.
OnUnknownProtocolFires when the first message does not match a known protocol so the connection can be accepted or rejected.
OnUnknownAuthenticationFires when authentication is enabled and the authentication method is not recognized.

Data

NameDescription
OnMessageFires every time a client sends a text message and it is received by the server.
OnBinaryFires every time a client sends a binary message and it is received by the server.
OnFragmentedFires when a fragment of a message is received (only when Options.FragmentedMessages is frgAll or frgOnlyFragmented).

Reliability

NameDescription
OnBeforeHeartBeatFires before each HeartBeat ping so the application can implement a custom keep-alive.
OnLoadBalancerConnectFires when the server connects to the Load Balancer Server.
OnLoadBalancerDisconnectFires when the server disconnects from the Load Balancer Server.
OnLoadBalancerErrorFires when an error occurs communicating with the Load Balancer Server.

Security

NameDescription
OnAuthenticationFires when authentication is enabled so the application can check user and password.
OnSSLGetHandlerFires before the SSL handler is created so a custom handler instance can be supplied.
OnSSLAfterCreateHandlerFires after the SSL handler has been created so its properties can be customized.
OnSSLALPNSelectFires during an ALPN-enabled handshake so the application can pick which protocol to negotiate.
OnSSLVerifyPeerFires when VerifyCertificate is enabled and the client presents a certificate to be accepted or rejected.

All Events (alphabetical)

NameDescription
OnAuthenticationFires when authentication is enabled so the application can check user and password.
OnBeforeHeartBeatFires before each HeartBeat ping so the application can implement a custom keep-alive.
OnBinaryFires every time a client sends a binary message and it is received by the server.
OnConnectFires every time a WebSocket connection is established with a client.
OnDisconnectFires every time a WebSocket connection with a client is dropped.
OnErrorFires whenever a WebSocket protocol error occurs, such as a mal-formed handshake.
OnExceptionFires whenever an unhandled exception is raised while processing a client connection.
OnFragmentedFires when a fragment of a message is received (only when Options.FragmentedMessages is frgAll or frgOnlyFragmented).
OnHandshakeFires after the handshake is evaluated on the server side and before the response is sent.
OnLoadBalancerConnectFires when the server connects to the Load Balancer Server.
OnLoadBalancerDisconnectFires when the server disconnects from the Load Balancer Server.
OnLoadBalancerErrorFires when an error occurs communicating with the Load Balancer Server.
OnMessageFires every time a client sends a text message and it is received by the server.
OnShutdownFires after the server has stopped and no more connections are accepted.
OnSSLAfterCreateHandlerFires after the SSL handler has been created so its properties can be customized.
OnSSLALPNSelectFires during an ALPN-enabled handshake so the application can pick which protocol to negotiate.
OnSSLGetHandlerFires before the SSL handler is created so a custom handler instance can be supplied.
OnSSLVerifyPeerFires when VerifyCertificate is enabled and the client presents a certificate to be accepted or rejected.
OnStartupFires after the server has started and is ready to accept connections.
OnTCPConnectFires after a client connects at TCP level and before the WebSocket handshake, so the connection can be accepted or rejected.
OnUnknownAuthenticationFires when authentication is enabled and the authentication method is not recognized.
OnUnknownProtocolFires when the first message does not match a known protocol so the connection can be accepted or rejected.