A message
event informs the target, a WebSocket
, RTCDataChannel
, EventSource
, or a BroadcastChannel
object, that a message has been received.
If the target is a RTCDataChannel
, an event handler for this event can be added via the RTCDataChannel.onmessage
property.
If the target is a BroadcastChannel
, an event handler for this event can be added via the BroadcastChannel.onmessage
property.
MessageEvent
or RTCDataChannelEvent
RTCDataChannel
, WebSocket
, EventSource
, BroadcastChannel
A MessageEvent
being an Event
, this event also implements these properties.
data
Read only
DOMString
containing the message received.A MessageEvent
being an Event
, this event also implements its methods.
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'message on RTCDataChannel' in that specification. | Candidate Recommendation | Adds RTCDataChannel as an EventTarget and defines when this event is sent. |
HTML Living Standard The definition of 'the message event' in that specification. | Living Standard | Adds BroadcastChannel as an EventTarget and defines when this event is sent. |
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | No support | (Yes) | ? |
on BroadcastChannel
| No support | No support | 38 (38) | No support | No support | No support |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | ? | ? | (Yes) | ? | No support | ? | ? |
on BroadcastChannel
| No support | No support | No support | 38.0 (38) | No support | No support | No support |
© 2005–2018 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/Events/message