CloseEvent Class
The event fired when a WebSocket is closed (https://websockets.spec.whatwg.org/#the-closeevent-interface).
public sealed class CloseEvent : Event- Inheritance
EventCloseEvent
Constructors
| Name | Description |
|---|---|
| CloseEvent(string, CloseEventInit?) | Creates a close event with the given type and initialization dictionary. |
CloseEvent(string, CloseEventInit?)
CloseEvent.csCreates a close event with the given type and initialization dictionary.
public CloseEvent(string type, CloseEventInit? eventInitDict = null)Properties
| Name | Description |
|---|---|
| Code | Gets the WebSocket connection close code (https://www.rfc-editor.org/rfc/rfc6455#section-7.1.5): the status code of the Close frame received from the server, 1005 when it has no status code, or 1006 when no Close frame was received (e.g. the connection failed). |
| Reason | Gets the WebSocket connection close reason: the reason of the Close frame received from the server, or the empty string. |
| WasClean | Gets whether the connection closed cleanly: the closing handshake completed. |
Code
CloseEvent.csGets the WebSocket connection close code (https://www.rfc-editor.org/rfc/rfc6455#section-7.1.5): the status code of the Close frame received from the server, 1005 when it has no status code, or 1006 when no Close frame was received (e.g. the connection failed).
public ushort Code { get; }Reason
CloseEvent.csGets the WebSocket connection close reason: the reason of the Close frame received from the server, or the empty string.
public string Reason { get; }WasClean
CloseEvent.csGets whether the connection closed cleanly: the closing handshake completed.
public bool WasClean { get; }