TsgcWebSocketServer_HTTPAPI › Events

TsgcWebSocketServer_HTTPAPI Events

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

Lifecycle

NameDescription
OnStartupFires after the HTTP API server has started and is ready to accept connections.
OnShutdownFires after the HTTP API server has stopped and no more requests are accepted.
OnBeforeBindingFires before the server binds to the configured URL, so the list of bindings can be inspected or customized.
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.
OnUnknownProtocolNot currently supported by the HTTP API server; declared for API compatibility with TsgcWebSocketServer.

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).

HTTP

NameDescription
OnHTTPRequestFires when the server receives an HTTP request so the application can build the response.
OnBeforeForwardHTTPFires before an HTTP request is dispatched so it can be forwarded (reverse-proxied) to another HTTP server.
OnAfterForwardHTTPFires after an HTTP request has been forwarded so the application can inspect the result or an error returned by the upstream server.

HTTP Upload

NameDescription
OnHTTPUploadBeforeSaveFileFires before a file extracted from a multipart/form-data upload is saved to disk so the name and path can be customized.
OnHTTPUploadAfterSaveFileFires after a file extracted from a multipart/form-data upload has been saved to disk.
OnHTTPUploadReadInputFires when the multipart/form-data decoder reads a non-file input field so its value can be captured.
OnHTTPUploadBeforeCreatePostStreamFires after the request headers have been read and before the POST stream is created so the upload can be accepted or rejected.

Reliability

NameDescription
OnBeforeHeartBeatFires before each HeartBeat ping so the application can implement a custom keep-alive.
OnAsynchronousFires when an asynchronous send operation initiated by the HTTP API server has completed.

Security

NameDescription
OnAuthenticationFires when authentication is enabled so the application can check user and password and accept or reject the connection.

All Events (alphabetical)

NameDescription
OnAfterForwardHTTPFires after an HTTP request has been forwarded so the application can inspect the result or an error returned by the upstream server.
OnAsynchronousFires when an asynchronous send operation initiated by the HTTP API server has completed.
OnAuthenticationFires when authentication is enabled so the application can check user and password and accept or reject the connection.
OnBeforeBindingFires before the server binds to the configured URL, so the list of bindings can be inspected or customized.
OnBeforeForwardHTTPFires before an HTTP request is dispatched so it can be forwarded (reverse-proxied) to another HTTP server.
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.
OnHTTPRequestFires when the server receives an HTTP request so the application can build the response.
OnHTTPUploadAfterSaveFileFires after a file extracted from a multipart/form-data upload has been saved to disk.
OnHTTPUploadBeforeCreatePostStreamFires after the request headers have been read and before the POST stream is created so the upload can be accepted or rejected.
OnHTTPUploadBeforeSaveFileFires before a file extracted from a multipart/form-data upload is saved to disk so the name and path can be customized.
OnHTTPUploadReadInputFires when the multipart/form-data decoder reads a non-file input field so its value can be captured.
OnMessageFires every time a client sends a text message and it is received by the server.
OnShutdownFires after the HTTP API server has stopped and no more requests are accepted.
OnStartupFires after the HTTP API 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.
OnUnknownProtocolNot currently supported by the HTTP API server; declared for API compatibility with TsgcWebSocketServer.