MessageEvent
interfaceMessages in server-sent events, web sockets, cross-document
messaging, channel messaging, and broadcast channels use the
MessageEvent
interface for their message
events:
data
Support in all current engines.
Returns the data of the message.
origin
Support in all current engines.
Returns the origin of the message, for server-sent events and cross-document messaging.
lastEventId
Support in all current engines.
Returns the last event ID string, for server-sent events.
source
Support in all current engines.
Returns the WindowProxy
of the source window, for cross-document
messaging, and the MessagePort
being attached, in the connect
event fired at
SharedWorkerGlobalScope
objects.
ports
Support in all current engines.
Returns the MessagePort
array sent with the message, for cross-document
messaging and channel messaging.
Various APIs (e.g., WebSocket
, EventSource
) use the
MessageEvent
interface for their message
event
without using the MessagePort
API.