Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

postMessage method

Sends messages between two connected MessagePorts in a MessageChannel.

HTML5 Web Messaging

Syntax

MessagePort.postMessage(msg, ports);

Parameters

msg [in]

One of the following:

postMessage cannot send a function as a message.

ports [in, optional]

A JavaScript array of MessagePort objects to send to the receiving MessagePort.

Return value

This method does not return a value.

Standards information

Remarks

When you create a new MessageChannel object, it has two connected MessagePort objects that can only send and receive messages between them. If the ports parameter is supplied but contains errors, an InvalidStateError exception is thrown. Sending a message containing an un-supported object (such as a function), a DataCloneError exception is thrown.

For more info, see MessageChannel for a working messaging demo.

See also

MessagePort
Worker
MessageChannel
Web worker demo

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.