Disconnected Event
Fired when a WebSocket connection is disconnected.
Syntax
type TDisconnectedEvent = procedure ( Sender: TObject; ConnectionId: Integer; StatusCode: Integer; const Description: String ) of Object;
property OnDisconnected: TDisconnectedEvent read FOnDisconnected write FOnDisconnected;
Remarks
When the connection is closed the StatusCode parameter may be used to determine if the disconnect occurred normally or if there was an error condition. If the connection is closed normally the StatusCode will be 1000. The Description parameter will contain a textual description returned by the server. Common StatusCode values are:
1000 (default) | Normal closure. |
1001 | The resource is going away. For instance the server is shutting down or a browser is navigating away from the page. |
1002 | A protocol error occurred. |
1003 | Unexpected data was received (e.g., an endpoint that only accepts text data could send this if binary data is received). |
1007 | Invalid payload data was received (e.g., an endpoint that receives non-UTF-8 data in a text message could send this). |
1008 | A generic code that indicates the endpoint received a message that violates its policy. |
1009 | A message that was too large was received. |
1010 | A required extension could not be negotiated. |
1011 | An unexpected error occurred. |