Table of Contents

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

type string
eventInitDict CloseEventInit

Remarks

-CloseEvent, the interface of the objects it constructs.

See also on MDN

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)

See also on MDN

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)

See also on MDN

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.

Remarks