ChannelListen
✖
ChannelListen
applies func to the association corresponding to each message received on the channel.
stores each message received on the channel, without applying any function.
listens on the specified URL, storing messages received, without requiring an explicit channel to exist on the channel broker.
Details and Options


- ChannelListen[…] gives a ChannelListener object.
- In ChannelListen[channel,…], channel can be specified as a channel object or in any of the forms used inside ChannelObject.
- ChannelListen[channel] is equivalent to ChannelListen[channel,Automatic].
- If specified in ChannelListen[channel,func], func overrides the "MessageReceived" handler of channel. It is called with the association containing the following elements:
-
"Message" contents of the message "MessageID" unique message ID "Timestamp" server timestamp for the message "RequesterWolframID" Wolfram ID of the sender "RequesterWolframUUID" Wolfram UUID of the sender "ListenerID" ID of the current listener - The contents of a message are given literally if the message is a string, Real, Integer, ByteArray, True, False, Null, Image or Image3D, or a list or association of such objects. All other messages are given either in the form HoldComplete[DisableFormatting[expr]] or as a list or association of delayed rules of the form "name"DisableFormatting[val].
- For security reasons, you should exercise caution in accessing unevaluated message contents, such as parts of held expressions, right-hand sides of delayed rules, or applying ToExpression to string messages.
- ChannelListen accepts the following options:
-
AutoRemove False whether to remove the listener after receiving one message ChannelBase $ChannelBase default channel base to assume ChannelHistoryLength 100 how many messages to store in the listener cache NotificationFunction Inherited notification to give when a message arrives - A channel listener set up by ChannelListen can be removed using RemoveChannelListener.
- Removing a channel listener discards messages cached by the listener.
- Terminating a Wolfram Language session removes all active channel listeners.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Create a channel and start listening:

https://wolfram.com/xid/0dc0bogzwjpk-xsn0q0


https://wolfram.com/xid/0dc0bogzwjpk-euklnx

Send a message to the channel and retrieve the contents of the message from the listener:

https://wolfram.com/xid/0dc0bogzwjpk-hawpj5


https://wolfram.com/xid/0dc0bogzwjpk-3osp8w

Remove the listener and delete the channel:

https://wolfram.com/xid/0dc0bogzwjpk-w0dbtb


https://wolfram.com/xid/0dc0bogzwjpk-8gl4ny

Define a custom handler function that will be executed when a message arrives:

https://wolfram.com/xid/0dc0bogzwjpk-0sncuz

Sending a message to the channel causes the function to be called:

https://wolfram.com/xid/0dc0bogzwjpk-2k7ikw
The message is also recorded in the ChannelListener object:

https://wolfram.com/xid/0dc0bogzwjpk-w064n

Remove the listener and delete the channel:

https://wolfram.com/xid/0dc0bogzwjpk-jovpyu


https://wolfram.com/xid/0dc0bogzwjpk-lhcren

Scope (4)Survey of the scope of standard use cases
Channel Specifications (2)
Listen on a channel defined by a ChannelObject:

https://wolfram.com/xid/0dc0bogzwjpk-n6zvuh


https://wolfram.com/xid/0dc0bogzwjpk-1o49p

Listen on a channel in your home area on the channel broker server, specifying its name:

https://wolfram.com/xid/0dc0bogzwjpk-xvvgx3

Listen on a channel specified by its fully qualified name:

https://wolfram.com/xid/0dc0bogzwjpk-5qsn5x


https://wolfram.com/xid/0dc0bogzwjpk-fndemb

Listen on a channel specified by its full URL:

https://wolfram.com/xid/0dc0bogzwjpk-v87ful


https://wolfram.com/xid/0dc0bogzwjpk-5x6mlh

Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-08uzsv

Listen on a channel in the common area on the server, specified by a URL:

https://wolfram.com/xid/0dc0bogzwjpk-x0i4f7


https://wolfram.com/xid/0dc0bogzwjpk-4jbnm0

Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-duvv31

Handlers (2)
Examine the arguments received by the handler function:

https://wolfram.com/xid/0dc0bogzwjpk-lg7ter

Sending a message to the channel prints the association received by the handler:

https://wolfram.com/xid/0dc0bogzwjpk-ouqurj
Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-b2yqgu

Do not execute any handler function when messages are received:

https://wolfram.com/xid/0dc0bogzwjpk-x2prwp


https://wolfram.com/xid/0dc0bogzwjpk-8eqdd0

You can still retrieve messages sent to the channel:

https://wolfram.com/xid/0dc0bogzwjpk-fiw72k

https://wolfram.com/xid/0dc0bogzwjpk-m4lxtc

Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-bdvv55

Options (3)Common values & functionality for each option
AutoRemove (1)
Launch a listener that will remove itself after the first message is received:

https://wolfram.com/xid/0dc0bogzwjpk-8mffp1


https://wolfram.com/xid/0dc0bogzwjpk-oz22h0

The listener is automatically removed after a message is sent and processed:

https://wolfram.com/xid/0dc0bogzwjpk-brpqjr

https://wolfram.com/xid/0dc0bogzwjpk-s4xgyn


https://wolfram.com/xid/0dc0bogzwjpk-2k9q4g

ChannelHistoryLength (1)
Create a channel listener with ChannelHistoryLength set to 10:

https://wolfram.com/xid/0dc0bogzwjpk-87z68e

Send 20 messages to the channel:

https://wolfram.com/xid/0dc0bogzwjpk-8swf9h
Only the 10 most-recently received messages are stored:

https://wolfram.com/xid/0dc0bogzwjpk-d2b1ws

Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-2evtev
NotificationFunction (1)
Define a custom notification function in the listener:

https://wolfram.com/xid/0dc0bogzwjpk-f136m0

The function is executed once a message is sent and processed:

https://wolfram.com/xid/0dc0bogzwjpk-yvw7lu
Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-oqoavp
Applications (4)Sample problems that can be solved with this function
Email (1)
In a desktop session, set up a listener that speaks the subject of an incoming message:

https://wolfram.com/xid/0dc0bogzwjpk-9jzv0n

Create a MailReceiverFunction that forwards received mail to your listener:

https://wolfram.com/xid/0dc0bogzwjpk-56h9rs

Send an email to the receiver function and hear your listener speak:

https://wolfram.com/xid/0dc0bogzwjpk-9nprud


https://wolfram.com/xid/0dc0bogzwjpk-lcm6ih
Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-fy7wy3
Remote Evaluation (1)
In your Wolfram Cloud account, or any other remote Wolfram System, set up a listener that evaluates incoming messages and sends the result back to a specified channel:

https://wolfram.com/xid/0dc0bogzwjpk-jj8zcz

Set up a receiving channel on your local system:

https://wolfram.com/xid/0dc0bogzwjpk-el4is7

Send a command to the remote evaluator:

https://wolfram.com/xid/0dc0bogzwjpk-rxt9d4

https://wolfram.com/xid/0dc0bogzwjpk-ka550r

Verify that the result is coming from a different machine:

https://wolfram.com/xid/0dc0bogzwjpk-rh1br7


https://wolfram.com/xid/0dc0bogzwjpk-6s1zi6

Wolfram Cloud (1)
ChannelListen allows your current session to receive updates from APIFunction, FormFunction and other functions as they are executed in the Wolfram Cloud:

https://wolfram.com/xid/0dc0bogzwjpk-6y14he


https://wolfram.com/xid/0dc0bogzwjpk-bfg93j

Deploy a webpage that performs a simple operation and sends the result along with some metadata to the listener:

https://wolfram.com/xid/0dc0bogzwjpk-fbtoui

The listener dynamically updates as soon as the web form is submitted:

https://wolfram.com/xid/0dc0bogzwjpk-gohcuu
Social Media (1)
Create an APIFunction that forwards the contents of HTTP requests to a channel:

https://wolfram.com/xid/0dc0bogzwjpk-5zhqcc

Create an IFTTT applet that tracks mentions of the word "Mathematica" on Twitter and sends them to the APIFunction via HTTP:
Create a listener on the channel:

https://wolfram.com/xid/0dc0bogzwjpk-4a19nf

Create a service connection to Twitter and send a tweet containing the keyword:

https://wolfram.com/xid/0dc0bogzwjpk-y7lb67


https://wolfram.com/xid/0dc0bogzwjpk-7hl8gp

List the messages received by the listener:

https://wolfram.com/xid/0dc0bogzwjpk-7xfs93


https://wolfram.com/xid/0dc0bogzwjpk-wu50ys
Properties & Relations (3)Properties of the function, and connections to other functions
ChannelListen returns a ChannelListener object:

https://wolfram.com/xid/0dc0bogzwjpk-biiwa2

You can query the listener and retrieve its properties:

https://wolfram.com/xid/0dc0bogzwjpk-52l2ii

Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-gg2vhi
Use RemoveChannelListener to remove a ChannelListener object:

https://wolfram.com/xid/0dc0bogzwjpk-l5tsgg


https://wolfram.com/xid/0dc0bogzwjpk-oddcyi


https://wolfram.com/xid/0dc0bogzwjpk-0vkwbg
On desktop Wolfram systems, output of Print executed in the message handler function is directed to the Messages window:

https://wolfram.com/xid/0dc0bogzwjpk-sr2hzv


https://wolfram.com/xid/0dc0bogzwjpk-8b3fzi
Delete the channel, which removes the listener:

https://wolfram.com/xid/0dc0bogzwjpk-djyhx6
Possible Issues (1)Common pitfalls and unexpected behavior
For security reasons, you cannot listen on other users' channels by default:

https://wolfram.com/xid/0dc0bogzwjpk-cg317f


https://wolfram.com/xid/0dc0bogzwjpk-n1hkqu


If you trust the channel author to potentially execute a message handler function on your computer, you can temporarily override the security setting:

https://wolfram.com/xid/0dc0bogzwjpk-sdl0a1

https://wolfram.com/xid/0dc0bogzwjpk-uf4ywb


https://wolfram.com/xid/0dc0bogzwjpk-ynb231
Neat Examples (1)Surprising or curious use cases
Start listening on a channel and arrange to dynamically plot incoming points as they arrive:

https://wolfram.com/xid/0dc0bogzwjpk-sjww7i


https://wolfram.com/xid/0dc0bogzwjpk-8hdner

Send data to the channel from the current session or from any other Wolfram Language session connected to the internet:

https://wolfram.com/xid/0dc0bogzwjpk-hg74k
Set up a task to send points periodically to a channel's URL:

https://wolfram.com/xid/0dc0bogzwjpk-55lljj

Stop sending data and delete the channel:

https://wolfram.com/xid/0dc0bogzwjpk-ygiyv4


https://wolfram.com/xid/0dc0bogzwjpk-8gii2t
Wolfram Research (2016), ChannelListen, Wolfram Language function, https://reference.wolfram.com/language/ref/ChannelListen.html (updated 2020).
Text
Wolfram Research (2016), ChannelListen, Wolfram Language function, https://reference.wolfram.com/language/ref/ChannelListen.html (updated 2020).
Wolfram Research (2016), ChannelListen, Wolfram Language function, https://reference.wolfram.com/language/ref/ChannelListen.html (updated 2020).
CMS
Wolfram Language. 2016. "ChannelListen." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ChannelListen.html.
Wolfram Language. 2016. "ChannelListen." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ChannelListen.html.
APA
Wolfram Language. (2016). ChannelListen. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChannelListen.html
Wolfram Language. (2016). ChannelListen. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChannelListen.html
BibTeX
@misc{reference.wolfram_2025_channellisten, author="Wolfram Research", title="{ChannelListen}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ChannelListen.html}", note=[Accessed: 26-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_channellisten, organization={Wolfram Research}, title={ChannelListen}, year={2020}, url={https://reference.wolfram.com/language/ref/ChannelListen.html}, note=[Accessed: 26-April-2025
]}