Collect Data from HTTP Requests
Start a listener that speaks the value of the parameter param when a message containing param arrives.
In[1]:=
listener =
ChannelListen["speak",
Speak["Arrived " <> ToString[Lookup[#Message, "param"]]] &,
Permissions -> "Public"]
Out[1]=
Send a message to the listener from a terminal on the same or any other machine using cURL, and hear your listener speak.
In[2]:=
"curl \"" <>
URLBuild[listener["URL"], {"operation" -> "send",
"param" -> 123}] <> "\""
Out[2]=
Out[3]=
Send a message from a web browser.
In[4]:=
URLBuild[listener["URL"], {"operation" -> "send", "param" -> 456}]
Out[4]=
Out[5]=
Send a message from a Wolfram System.
In[6]:=
ChannelSend[$WolframID <> ":speak", <|"param" -> 789|>]
Out[6]=
All data received by the listener.
In[7]:=
listener["Dataset"]
Out[7]=