sends the specified message msg to the specified channel.
Details and Options
- In ChannelSend[channel,…], channel can be specified as a channel object or in any of the forms used inside ChannelObject.
- The message msg can be any expression.
- With the default setting $AllowExternalChannelFunctions=False, ChannelSend[channel,…] works only for certified channels and for channels owned by you.
- All messages are internally serialized to WXF before being transmitted through the channel broker server, with the exception of bare strings, which are transmitted as is.
- Any non-Wolfram Language–based channel broker clients that may be released in the future are likely to only support string messages, so if you desire to make your program's messages forward compatible with such clients, it is suggested to encode them in a language-independent string format such as JSON or XML.
- ChannelSend only blocks until the message has been transmitted to the broker; it does not wait for the broker to acknowledge receipt.
Examplesopen allclose all
Basic Examples (1)
The message is available from the listener, in the form specified for the ChannelListener object:
Create a channel to transmit data encoded as a JSON string:
Properties & Relations (2)
Possible Issues (1)
Messages sent to a channel will not be immediately available from listeners connected to the channel, as ChannelSend returns asynchronously:
A While loop can also be used to wait until a message is available from the listener:
Wolfram Research (2016), ChannelSend, Wolfram Language function, https://reference.wolfram.com/language/ref/ChannelSend.html (updated 2020).
Wolfram Language. 2016. "ChannelSend." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ChannelSend.html.
Wolfram Language. (2016). ChannelSend. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChannelSend.html