blob: 4379f0fd008ffe7d92e817f4b276d461e3b85f8c (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
---
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>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>功能</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>基本支援</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatGeckoDesktop("2.0") }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>基本支援</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
</tr>
</tbody>
</table>
</div>
<h3 id="Gecko_備註">Gecko 備註</h3>
<div class="geckoVersionNote">
<p>{{ gecko_callout_heading("6.0") }}</p>
<p>此時此刻,Gecko 不支援 <code><a href="/en/JavaScript_typed_arrays/ArrayBuffer" title="en/JavaScript typed arrays/ArrayBuffer">ArrayBuffer</a></code> 或 {{ domxref("Blob") }} 作為 <code>data</code>。</p>
</div>
<p>{{ languages ( {"en": "en/WebSockets/WebSockets_reference/MessageEvent"} ) }}</p>
|