WebSocket.onmessage

这篇翻译不完整。请帮忙从英语翻译这篇文章

WebSocket.onmessage 属性返回一事件监听器,当从服务器收到一条消息时,该监听器将被调用。该监听器接受一命名为 message 的 MessageEvent

语法

aWebSocket.onmessage = function(event) {
  console.debug("WebSocket message received:", event);
};

一个 EventListener.

规范

规范 状态 注释
HTML Living Standard
WebSocket: onmessage
Living Standard 初始定义

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge ? Firefox Full support YesIE ? Opera Full support YesSafari ? WebView Android ? Chrome Android Full support YesEdge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

此页面的贡献者: Ray-Eldath
最后编辑者: Ray-Eldath,