The WebSocket.onclose
property returns the event listener to be called when the WebSocket connection's readyState
changes to CLOSED
. The listener receives a CloseEvent
named "close".
aWebSocket.onclose = function(event) { console.log("WebSocket is closed now."); };
An EventListener
.
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'WebSocket: onclose' in that specification. | Living Standard | Initial definition |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/onclose