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.
MessageEvent()MessageEvent.This interface also inherits properties from its parent, Event.
MessageEvent.data Read only
DOMString, Blob or an ArrayBuffer containing the data send by the emitter.MessageEvent.originDOMString …MessageEvent.portsMessageEvent.sourceThis interface also inherits methods from its parent, Event.
MessageEvent.initMessageEvent()
MessageEvent() constructor instead.| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 1 | (Yes) | 4.0 (2.0)[1] | 9 | ? | 10.0+ |
| Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | ? | (Yes) | ? | ? | ? | 3.0+ |
[1] As of Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8), Gecko supports ArrayBuffer for data, but not Blob.
ExtendableMessageEvent, similar to this interface, and used in interfaces that needs to give more flexibility to authors.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent