Class CloseEvent
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
[Value("CloseEvent")]
public class CloseEvent : Event
- Inheritance
-
CloseEvent
- Inherited Members
Remarks
Constructors
CloseEvent()
public CloseEvent()
CloseEvent(string, CloseEventInit)
The CloseEvent() constructor creates a new CloseEvent object.
public CloseEvent(string type, CloseEventInit eventInitDict = null)
Parameters
typestringeventInitDictCloseEventInit
Remarks
-CloseEvent, the interface of the objects it constructs.
Properties
Code
The code read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
[Value("code")]
public ushort Code { get; }
Property Value
- ushort
An integer WebSocket connection close code in the range
1000-4999, indicating the reason the connection was closed.
Remarks
-RFC 6455 (the WebSocket Protocol specification)
-WebSocket Close Code Number Registry (IANA)
Reason
The reason read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
[Value("reason")]
public string Reason { get; }
Property Value
- string
A string.
Remarks
-RFC 6455 (the WebSocket Protocol specification)
WasClean
The wasClean read-only property of the CloseEvent interface returns true if the connection closed cleanly.
[Value("wasClean")]
public bool WasClean { get; }
Property Value
- bool
A boolean value. True if the connection closed cleanly, false otherwise.