Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content

onopen event

Fires when a WebSocket is connected.


Event Property object.onopen = handler;
addEventListener Method object.addEventListener("open", handler, useCapture)


Event handler parameters

handler [in]

Type: Function

Event handler to call when a WebSocket connect is made.


This event fires only when a connection is made. To determine if a connection is still open, use readyState. If you provide a protocol when opening a WebSocket, it is recommended that the app check the protocol property to ensure the protocol was accepted by the server.

See also

WebSockets in Windows
WebSockets RFC 6455
The WebSocket API



© 2015 Microsoft