API reference › @evolu/common › WebSocket › WebSocketCloseEvent

Defined in: packages/common/src/WebSocket.ts:163

What a WebSocket reports when a connection closes.

These are the fields every platform provides. Evolu does not use the DOM CloseEvent type: React Native delivers its own close event and exposes no CloseEvent global, so promising the DOM type would promise an inheritance chain and an instanceof that do not hold there. A platform's own close event is structurally assignable to this, and createWebSocket passes it through unchanged, so a caller that knows its platform can narrow it.

Properties

code

readonly code: number;

Defined in: packages/common/src/WebSocket.ts:165

https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code


reason

readonly reason: string;

Defined in: packages/common/src/WebSocket.ts:168

https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/reason


wasClean

readonly wasClean: boolean;

Defined in: packages/common/src/WebSocket.ts:171

Whether the connection closed after a completed closing handshake.