Message Boards Message Boards

Send message outside Mathematica through Channel-Based Network?


Channel-Based communication is available since release 11.0 as an experimental functionality for publish-subscribe communication between WL sessions or with external systems.

Functionality works well between WL sessions, but when trying to send messages through external systems, I was unable to make this work.,

myChannel = CreateChannel["demo", Permissions -> "Public"]

listener = ChannelListen[myChannel];

ChannelSend[myChannel, <|key -> "test"|>]
(*Message Successful*)

Prepare command for curl (or web browser)
url = URLBuild[listener["URL"], {"operation" -> "send", "Message" -> "yet another message"}]


(*Sending Message through the Mathematica Session works*)
(*message ID*)

When trying through terminal with curl URL, or through the web browser, or other languages in the same computer, or another device, the following message is displayed:

403 Forbidden

Please, can you test this on your system to see if the same issue is found in your computer system?

Mathematica version 11.x

POSTED BY: Diego Zviovich
1 year ago

Hi Diego,

What are the permissions of the channel you are trying to send? To send a message through say a web browser, or other HTTP client, the channel needs to be publically writable, with Permissions-><|"All"->"Write",...|>

Let me know if that works for you, but note that doing this will let anyone send any message on your channel.



POSTED BY: Ian Johnson
1 year ago

Ian, this is are the options of the channel

<|ChannelPreSendFunction -> Automatic, HandlerFunctions -> None, 
 Initialization -> Automatic, 
 MetaInformation -> <|"OwnerID" -> ""|>, 
 NotificationFunction -> Inherited, 
 Permissions -> <|All -> {"Write", "Read"}, 
   "" -> "Execute"|>, 
 ChannelBase -> "", 
 "URLRendering" -> Automatic|>
POSTED BY: Diego Zviovich
1 year ago

Hi Ian, the permissions read,

Permissions -> <|All -> {"Write", "Read"}, "" -> "Execute"|>

POSTED BY: Diego Zviovich
1 year ago

When copying a URL to external programs, make sure that you are using Edit > Copy As > Plain Text (Cmnd-Shift-C on Mac)... or otherwise remove the line continuation characters ("\") that the Front End inserts in the copied text.

As yet another trick, you can execute:


... and then click the output link. That will use the correct URL in your default web browser.

POSTED BY: Igor Bakshee
1 year ago

Group Abstract Group Abstract