この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
A MessageEvent
is the interface representing a message received by a target, being a WebSocket
or a WebRTC RTCDataChannel
The action triggered by this event is set via an event handler set on WebSocket.onmessage
or RTCDataChannel.onmessage
.
Note: This feature is available in Web Workers.
Constructor
MessageEvent()
- Creates a new
MessageEvent
.
Properties
This interface also inherits properties from its parent, Event
.
MessageEvent.data
Read only- Returns a
DOMString
,Blob
or anArrayBuffer
containing the data send by the emitter. MessageEvent.origin
- Is a
DOMString
… MessageEvent.ports
- …
MessageEvent.source
- …
Methods
This interface also inherits methods from its parent, Event
.
MessageEvent.initMessageEvent()
- … Do not use this anymore: use the
MessageEvent()
constructor instead.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | ? | 4.0 (2.0)[1] | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |
[1] As of Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8), Gecko supports ArrayBuffer
for data, but not Blob
.
See also
ExtendableMessageEvent
, similar to this interface, and used in interfaces that needs to give more flexibility to authors.- WebSocket API
- WebRTC API
ドキュメントのタグと貢献者
タグ:
このページの貢献者:
Sebastianz,
teoli,
jpmedley,
fscholz,
DirectXMan12,
kscarfone,
Kennyluck,
evilpie,
Sheppy
最終更新者:
Sebastianz,