WebSocket.onmessage
属性是一个当收到来自服务器的消息时被调用的 EventHandler
。它由一个MessageEvent
调用。
语法
aWebSocket.onmessage = function(event) { console.debug("WebSocket message received:", event); };
值
一个 EventListener
.
规范
规范 | 状态 | 注释 |
---|---|---|
HTML Living Standard WebSocket: onmessage |
Living Standard | 初始定义 |
浏览器兼容性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.