aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/api/messageevent/index.html
blob: 8e2bb5baf0e9845e2129617740f2fb6081a43b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
title: MessageEvent
slug: Web/API/MessageEvent
tags:
  - WebSockets
translation_of: Web/API/MessageEvent
original_slug: WebSockets/WebSockets_reference/MessageEvent
---
<p>{{ draft() }}</p>
<p>當伺服器傳來資料時,客戶端會收到一個 <code>MessageEvent</code>,由 <code>WebSocket</code> 物件 <code>onmessage</code> 表示的監聽器接收。</p>
<h2 id="Attributes" name="Attributes">屬性</h2>
<table class="standard-table">
 <tbody>
  <tr>
   <td class="header">屬性</td>
   <td class="header">形態</td>
   <td class="header">描述</td>
  </tr>
  <tr>
   <td><code>data</code></td>
   <td>{{ domxref("DOMString") }} | {{ domxref("Blob") }} | <a href="/zh_tw/JavaScript_typed_arrays/ArrayBuffer" title="zh tw/JavaScript typed arrays/ArrayBuffer"><code>ArrayBuffer</code></a></td>
   <td>伺服器傳來的資料。</td>
  </tr>
 </tbody>
</table>
<h2 id="參見">參見</h2>
<ul>
 <li><a href="/zh_tw/WebSockets/WebSockets_reference/WebSocket" title="zh tw/WebSockets/WebSockets reference/WebSocket"><code>WebSocket</code></a></li>
</ul>
<h2 id="瀏覽器兼容">瀏覽器兼容</h2>
{{Compat("api.MessageEvent")}}