5
$\begingroup$

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"]
(*ChannelObject["https://channelbroker.wolframcloud.com/users/user@example.com/demo"]*)

listener = ChannelListen[myChannel];
Dynamic[listener["Message"]]

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

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

(*"https://channelbroker.wolframcloud.com/users/user%40example.com/demo?operation=send&Message=another+message"*)

(*Sending Message through the Mathematica Session works*)
URLExecute[url]
(*message ID*)

When trying through terminal with curl URL, or through the web browser, the following message is displayed:

403 Forbidden

$\endgroup$
  • $\begingroup$ I can replicate this problem. It happens just as you have described. $\endgroup$ – C. E. Feb 2 '17 at 0:38
4
$\begingroup$

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:

Hyperlink[url]

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

$\endgroup$
  • $\begingroup$ Dear Igor, thank you. I've got some extra questions about channel networks that I wouldwant to ask you. Please can you contact me via the wolfram community if you can $\endgroup$ – Zviovich Feb 3 '17 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.