TsgcWebSocketHTTPServer › Events
Events you can handle, grouped by purpose, followed by the full alphabetical list.
| Name | Description |
|---|---|
| OnStartup | Fires after the server has started and is ready to accept connections. |
| OnShutdown | Fires after the server has stopped and no more connections are accepted. |
| OnTCPConnect | Fires after a client connects at TCP level and before the WebSocket handshake, so the connection can be accepted or rejected. |
| OnConnect | Fires every time a WebSocket connection is established with a client. |
| OnDisconnect | Fires every time a WebSocket connection with a client is dropped. |
| OnHandshake | Fires after the handshake is evaluated on the server side and before the response is sent. |
| OnError | Fires whenever a WebSocket protocol error occurs, such as a mal-formed handshake. |
| OnException | Fires whenever an unhandled exception is raised while processing a client connection. |
| OnUnknownProtocol | Fires when the first message does not match a known protocol so the connection can be accepted or rejected. |
| OnUnknownAuthentication | Fires when authentication is enabled and the authentication method is not recognized by the server. |
| Name | Description |
|---|---|
| OnMessage | Fires every time a client sends a text message and it is received by the server. |
| OnBinary | Fires every time a client sends a binary message and it is received by the server. |
| OnFragmented | Fires when a fragment of a message is received (only when Options.FragmentedMessages is frgAll or frgOnlyFragmented). |
| Name | Description |
|---|---|
| OnBeforeCommand | Fires before OnCommandGet or OnCommandOther so the request can be screened, authorized, or short-circuited with a 401 response. |
| OnCommandGet | Fires when the HTTP server receives a GET, POST, or HEAD request so the application can build the response. |
| OnCommandOther | Fires when the HTTP server receives a method other than GET, POST or HEAD (PUT, DELETE, OPTIONS, PATCH...). |
| OnBeforeForwardHTTP | Fires before an HTTP request is dispatched so it can be forwarded (reverse-proxied) to another HTTP server. |
| OnAfterForwardHTTP | Fires after an HTTP request has been forwarded so the application can inspect the result or an error returned by the upstream server. |
| OnHTTP2BeforeAsyncRequest | Fires before an HTTP/2 request is queued so the application can choose whether it runs in the pool of threads or in the connection thread. |
| Name | Description |
|---|---|
| OnCreateSession | Fires when the HTTP server needs to create a new session so the application can supply a custom TIdHTTPSession instance. |
| OnSessionStart | Fires when an HTTP session is started and added to the SessionList. |
| OnSessionEnd | Fires when an HTTP session is closed, either explicitly or after SessionTimeout expires. |
| OnInvalidSession | Fires when an HTTP request presents an unknown or expired session ID so the application can decide how to react. |
| Name | Description |
|---|---|
| OnHTTPUploadBeforeSaveFile | Fires before a file extracted from a multipart/form-data upload is saved to disk so the name and path can be customized. |
| OnHTTPUploadAfterSaveFile | Fires after a file extracted from a multipart/form-data upload has been saved to disk. |
| OnHTTPUploadReadInput | Fires when the multipart/form-data decoder reads a non-file input field so its value can be captured. |
| OnHTTPUploadBeforeCreatePostStream | Fires after the request headers have been read and before the POST stream is created so the upload can be accepted or rejected. |
| Name | Description |
|---|---|
| OnBeforeHeartBeat | Fires before each HeartBeat ping so the application can implement a custom keep-alive. |
| OnLoadBalancerConnect | Fires when the server connects to the Load Balancer Server. |
| OnLoadBalancerDisconnect | Fires when the server disconnects from the Load Balancer Server. |
| OnLoadBalancerError | Fires when an error occurs communicating with the Load Balancer Server. |
| Name | Description |
|---|---|
| OnAuthentication | Fires when authentication is enabled so the application can check user and password and accept or reject the connection. |
| OnSSLGetHandler | Fires before the SSL handler is created so a custom server-side handler instance can be supplied. |
| OnSSLAfterCreateHandler | Fires after the SSL handler has been created so its properties can be customized. |
| OnSSLALPNSelect | Fires during an ALPN-enabled handshake so the application can pick which protocol to negotiate. |
| OnSSLVerifyPeer | Fires when VerifyCertificate is enabled and the client presents a certificate to be accepted or rejected. |
| Name | Description |
|---|---|
| OnAfterForwardHTTP | Fires after an HTTP request has been forwarded so the application can inspect the result or an error returned by the upstream server. |
| OnAuthentication | Fires when authentication is enabled so the application can check user and password and accept or reject the connection. |
| OnBeforeCommand | Fires before OnCommandGet or OnCommandOther so the request can be screened, authorized, or short-circuited with a 401 response. |
| OnBeforeForwardHTTP | Fires before an HTTP request is dispatched so it can be forwarded (reverse-proxied) to another HTTP server. |
| OnBeforeHeartBeat | Fires before each HeartBeat ping so the application can implement a custom keep-alive. |
| OnBinary | Fires every time a client sends a binary message and it is received by the server. |
| OnCommandGet | Fires when the HTTP server receives a GET, POST, or HEAD request so the application can build the response. |
| OnCommandOther | Fires when the HTTP server receives a method other than GET, POST or HEAD (PUT, DELETE, OPTIONS, PATCH...). |
| OnConnect | Fires every time a WebSocket connection is established with a client. |
| OnCreateSession | Fires when the HTTP server needs to create a new session so the application can supply a custom TIdHTTPSession instance. |
| OnDisconnect | Fires every time a WebSocket connection with a client is dropped. |
| OnError | Fires whenever a WebSocket protocol error occurs, such as a mal-formed handshake. |
| OnException | Fires whenever an unhandled exception is raised while processing a client connection. |
| OnFragmented | Fires when a fragment of a message is received (only when Options.FragmentedMessages is frgAll or frgOnlyFragmented). |
| OnHandshake | Fires after the handshake is evaluated on the server side and before the response is sent. |
| OnHTTP2BeforeAsyncRequest | Fires before an HTTP/2 request is queued so the application can choose whether it runs in the pool of threads or in the connection thread. |
| OnHTTPUploadAfterSaveFile | Fires after a file extracted from a multipart/form-data upload has been saved to disk. |
| OnHTTPUploadBeforeCreatePostStream | Fires after the request headers have been read and before the POST stream is created so the upload can be accepted or rejected. |
| OnHTTPUploadBeforeSaveFile | Fires before a file extracted from a multipart/form-data upload is saved to disk so the name and path can be customized. |
| OnHTTPUploadReadInput | Fires when the multipart/form-data decoder reads a non-file input field so its value can be captured. |
| OnInvalidSession | Fires when an HTTP request presents an unknown or expired session ID so the application can decide how to react. |
| OnLoadBalancerConnect | Fires when the server connects to the Load Balancer Server. |
| OnLoadBalancerDisconnect | Fires when the server disconnects from the Load Balancer Server. |
| OnLoadBalancerError | Fires when an error occurs communicating with the Load Balancer Server. |
| OnMessage | Fires every time a client sends a text message and it is received by the server. |
| OnSessionEnd | Fires when an HTTP session is closed, either explicitly or after SessionTimeout expires. |
| OnSessionStart | Fires when an HTTP session is started and added to the SessionList. |
| OnShutdown | Fires after the server has stopped and no more connections are accepted. |
| OnSSLAfterCreateHandler | Fires after the SSL handler has been created so its properties can be customized. |
| OnSSLALPNSelect | Fires during an ALPN-enabled handshake so the application can pick which protocol to negotiate. |
| OnSSLGetHandler | Fires before the SSL handler is created so a custom server-side handler instance can be supplied. |
| OnSSLVerifyPeer | Fires when VerifyCertificate is enabled and the client presents a certificate to be accepted or rejected. |
| OnStartup | Fires after the server has started and is ready to accept connections. |
| OnTCPConnect | Fires after a client connects at TCP level and before the WebSocket handshake, so the connection can be accepted or rejected. |
| OnUnknownAuthentication | Fires when authentication is enabled and the authentication method is not recognized by the server. |
| OnUnknownProtocol | Fires when the first message does not match a known protocol so the connection can be accepted or rejected. |