Web/API/WebSocket/onclose

From Get docs

The WebSocket.onclose property is an EventHandler that is called when the WebSocket connection's readyState changes to CLOSED. It is called with a CloseEvent.

Syntax

aWebSocket.onclose = function(event) {
  console.log("WebSocket is closed now.");
};

Value

An EventListener.

Specifications

Specification Status Comment
HTML Living StandardThe definition of 'WebSocket: onclose' in that specification. Living Standard Initial definition