aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/websocket/onmessage/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/websocket/onmessage/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/websocket/onmessage/index.html')
-rw-r--r--files/zh-cn/web/api/websocket/onmessage/index.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/websocket/onmessage/index.html b/files/zh-cn/web/api/websocket/onmessage/index.html
new file mode 100644
index 0000000000..27bcce6cf2
--- /dev/null
+++ b/files/zh-cn/web/api/websocket/onmessage/index.html
@@ -0,0 +1,49 @@
+---
+title: WebSocket.onmessage
+slug: Web/API/WebSocket/onmessage
+tags:
+ - API
+ - Web API
+ - WebSocket
+ - 参考
+ - 属性
+translation_of: Web/API/WebSocket/onmessage
+---
+<p>{{APIRef("Web Sockets API")}}</p>
+
+<p><code><strong>WebSocket.onmessage</strong></code> 属性是一个当收到来自服务器的消息时被调用的 {{domxref("EventHandler")}}。它由一个{{domxref("MessageEvent")}}调用。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>aWebSocket</em>.onmessage = function(event) {
+ console.debug("WebSocket message received:", event);
+};</pre>
+
+<h2 id="值">值</h2>
+
+<p>一个 {{domxref("EventListener")}}.</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', '#handler-websocket-onmessage', 'WebSocket: onmessage')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>初始定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.WebSocket.onmessage")}}</p>