ChannelListener

ChannelListener[]

represents a channel listener created by ChannelListen.

Details

  • ChannelListener[]["prop"] gives the property prop of a channel listener.
  • ChannelListener[]["prop",n] gives a list of properties for the n most recently received messages.
  • ChannelListener[]["prop",All] gives a list of properties for all messages stored.
  • ChannelListener[][{"prop1","prop2",},] gives a list of results for the propi.
  • Possible properties related to individual messages include:
  • "Message"contents of the message
    "MetaInformation"meta-information accompanying the message
    "FullMessage"message and meta-information
    "MessageID"ID for the message
    "Timestamp"server time stamp for the message
    "RequesterAddress"IP address of the sender
    "RequesterWolframID"Wolfram ID of the sender
    "RequesterWolframUUID"Wolfram UUID of the sender
  • The contents of a message are given literally if the message is a string, number, True, False, Null, 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.
  • Possible properties related to sets of messages include:
  • "TimeSeries"association of time series of elements in messages
    "Dataset"dataset of elements in messages
  • Properties related to the channel listener and channel:
  • "ReceivedMessageCount"total number of messages received by the listener
    "AvailableMessageCount"number of messages available from the listener
    "HandlerFunction"handler function applied to messages
    "Databin"databin (if any) associated with the channel
    "ChannelObject"the channel object being listened to
    "URL"the URL of the channel being listened to

Examples

open allclose all

Basic Examples  (1)

Create a ChannelListener object by starting to listen on a channel:

In[1]:=
Click for copyable input
Out[1]=

Send a message to the channel and retrieve it from the listener object:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Server time stamp for the message:

In[4]:=
Click for copyable input
Out[4]=

Send another message:

In[5]:=
Click for copyable input
Out[5]=

Retrieve all messages:

In[6]:=
Click for copyable input
Out[6]=

Retrieve two latest messages:

In[7]:=
Click for copyable input
Out[7]=

Stop listening:

In[8]:=
Click for copyable input
Out[8]=

Scope  (11)

Properties & Relations  (1)

Possible Issues  (1)

See Also

ChannelListen  RemoveChannelListener  ChannelObject

Introduced in 2016
(11.0)