({{, (RefLink[CreateChannel, paclet:ref/CreateChannel])[] 
creates a new channel for channel communication, with a generated name.}, {, (RefLink[CreateChannel, paclet:ref/CreateChannel])["path"] 
creates a channel with the specified path relative to the home area of the currently authenticated user.}, {, (RefLink[CreateChannel, paclet:ref/CreateChannel])[object]
creates an active channel associated with the specified channel object.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[CreateChannel, paclet:ref/CreateChannel])["path"] creates a channel at the URL ChannelBase/users/WolframID/path determined from your channel base and Wolfram ID.

(RefLink[CreateChannel, paclet:ref/CreateChannel])["/abspath"] works only if you have execute permissions at the absolute path specified.

(RefLink[CreateChannel, paclet:ref/CreateChannel]) accepts the same options as (RefLink[ChannelObject, paclet:ref/ChannelObject]).

If a channel corresponding to spec already exists, then (RefLink[CreateChannel, paclet:ref/CreateChannel])[spec] returns the corresponding channel object.

The channel broker server does not persist channels indefinitely; channels should be recreated in every session where they are going to be used.

OpenersPrimaryExamplesSection(Spacer1)Examples  (19)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create a new unnamed channel:

CreateChannel[]

A new channel in the home area of the currently authenticated user:

CreateChannel["example"]

OpenersExampleSection1(Spacer1)Scope  (6)

Create an unnamed channel in the common area on the channel broker server:

CreateChannel[]

Create a channel in the common area using a given UUID:

CreateUUID[]

CreateChannel["/channels/"<>%]

Create a named channel in your home area on the channel broker server:

CreateChannel["x"]

Create a named channel in a subdirectory of your home area:

CreateChannel["x/y"]

Create a channel using (RefLink[ChannelObject, paclet:ref/ChannelObject]) specifications:

ChannelObject["y"]

CreateChannel[%]

Give a special processing option to the new channel:

CreateChannel[HandlerFunctions-><|"MessageReceived"->Print|>]

OpenersExampleSection3(Spacer1)Properties & Relations  (9)

(RefLink[CreateChannel, paclet:ref/CreateChannel]) returns a (RefLink[ChannelObject, paclet:ref/ChannelObject]):

CreateChannel[]

Use (RefLink[Options, paclet:ref/Options]) to retrieve channel options stored on the server:

channel=CreateChannel[HandlerFunctions-><|"MessageReceived"->Print|>,ChannelPreSendFunction->(Compress[#]&)]

Options[channel]

Retrieve a specific option:

Options[channel,HandlerFunctions]

Use (RefLink[SetOptions, paclet:ref/SetOptions]) to change channel options on the server:

channel=CreateChannel[ChannelPreSendFunction->(Compress[#]&)]

SetOptions[channel,ChannelPreSendFunction->None]

Options[channel,ChannelPreSendFunction]

Custom handlers in channel options can be wrapped in (RefLink[DisableFormatting, paclet:ref/DisableFormatting]):

channel=CreateChannel["f",ChannelPreSendFunction->(Compress[#]&)]

Options[channel,ChannelPreSendFunction]

%//InputForm

(RefLink[ChannelListen, paclet:ref/ChannelListen]) can use the specified message handler for the channel:

channel=CreateChannel[HandlerFunctions-><|"MessageReceived"->(Speak[#Message]&)|>]

ChannelListen[channel]

ChannelSend[channel,"hello"]

(RefLink[ChannelSend, paclet:ref/ChannelSend]) uses the specified (RefLink[ChannelPreSendFunction, paclet:ref/ChannelPreSendFunction]) to format messages:

channel=CreateChannel[ChannelPreSendFunction->(Compress[#]&)]

listener=ChannelListen[channel]

ChannelSend[channel,"hello"]

The formatted message:

listener["Message"]

Examine the message content:

Uncompress[%,HoldComplete]

Extract the message:

ReleaseHold[%]

(RefLink[FindChannels, paclet:ref/FindChannels]) finds channels created with (RefLink[CreateChannel, paclet:ref/CreateChannel]):

FindChannels["x"]

(RefLink[DeleteChannel, paclet:ref/DeleteChannel]) deletes a channel created with (RefLink[CreateChannel, paclet:ref/CreateChannel]):

channel=CreateChannel[]

DeleteChannel[channel]

Recreate the channel after it has been deleted:

CreateChannel[channel]

Deploying (RefLink[ChannelReceiverFunction, paclet:ref/ChannelReceiverFunction]) creates a channel on the channel broker server, in addition to creating a cloud object:

CloudDeploy[ChannelReceiverFunction[#&]]

ChannelObject[%]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

You must connect to the Wolfram Cloud to create a channel:

CloudDisconnect[]

CreateChannel[]

Connect to the Wolfram Cloud and create a channel:

CloudConnect[]

CreateChannel[]

You cannot create channels in another user's home area:

CreateChannel["wrong-user@sample.com:foo"]

Create a channel in your home area instead:

CreateChannel["foo"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ChannelObject, paclet:ref/ChannelObject])  ▪  (RefLink[DeleteChannel, paclet:ref/DeleteChannel])  ▪  (RefLink[FindChannels, paclet:ref/FindChannels])  ▪  (RefLink[ChannelReceiverFunction, paclet:ref/ChannelReceiverFunction])  ▪  (RefLink[ChannelListen, paclet:ref/ChannelListen])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Channel-Based Communication, paclet:guide/Channel-BasedCommunication])}, {▪(RefLinkPlain[Using Connected Devices, paclet:guide/UsingConnectedDevices])}, {▪(RefLinkPlain[Mail, Messages, Etc., paclet:guide/MailMessagesEtc])}, {▪(RefLinkPlain[Network Programming, paclet:guide/NetworkProgramming])}})}})