message

« DOM Reference

An message event informs the target, a WebSocket, RTCDataConnection or a BroadcastChannel object, that a message has been received.

If the target is a RTCDataConnection, an event handler for this event can be added via the RTCDataConnection.onmessage property.

If the target is a BroadcastChannel, an event handler for this event can be added via the BroadcastChannel.onmessage property.

General infoEdit

Interface
MessageEvent
Bubbles
No
Cancelable
No
Target
RTCDataChannelEvent, WebSocket, BroadcastChannel
Default Action
None

PropertiesEdit

A MessageEvent being an Event, this event also implements these properties.

data Read only
Is a DOMString containing the message received.

MethodsEdit

A MessageEvent being an Event, this event also implements these properties.

SpecificationsEdit

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browser
The definition of 'message on RTCDataChannel' in that specification.
Working Draft Adds RTCDataChannel as an EventTarget and defines when this event is sent.
WHATWG HTML Living Standard
The definition of 'message on BroadcastChannel' in that specification.
Living Standard Adds BroadcastChannel as an EventTarget and defines when this event is sent.

Browser compatibilityEdit

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) Not supported (Yes) ?
on BroadcastChannel Not supported 38 (38) Not supported Not supported Not supported

See alsoEdit

  • WebRTC
  • BroadcastChannel API
  • WebSockets

Document Tags and Contributors

 Contributors to this page: teoli
 Last updated by: teoli,