WebSocket.onclose
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
WebSocket.onclose
属性返回一个事件监听器,这个事件监听器将在 WebSocket 连接的readyState
变为 CLOSED
时被调用,它接收一个名字为“close”的 CloseEvent
事件。
语法
WebSocket.onclose = function(event) { console.log("WebSocket is closed now."); };
值
规范
Specification |
---|
WebSockets Standard # dom-websocket-onclose |