WebSocket.onopen

The WebSocket.onopen property is an EventHandler that is called when the WebSocket connection's readyState changes to 1; this indicates that the connection is ready to send and receive data. It is called with an Event.

Syntax

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

Value

Specifications

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

Browser compatibility

BCD tables only load in the browser