임의 유형의 데이터 처리
JSON 형식 (문자열, 숫자, True, False, 또는 Null)으로 나타낼 수 있는 메시지, 목록, 규칙, 또는 이러한 요소를 포함하는 관련 조합은 그대로 주어집니다.
In[1]:=

listener = ChannelListen["example"]
Out[1]=

In[2]:=

(ChannelSend["example", #]) & /@ {"string", 100, True, {1, 2, 3},
"a" -> "b", {"c" -> 1}, <|"d" -> True|>};
In[3]:=

listener["Message", All]
Out[3]=

Wolfram 언어 코드를 포함하는 메시지는 안전을 위해 HoldComplete에 랩되므로 평가하기 전 체크 할 수 있는 기회를 줍니다.
In[4]:=

ChannelSend["example", Unevaluated[Print["hello"]]];
In[5]:=

listener["Message"]
Out[5]=

In[6]:=

listener["Message"] // ReleaseHold

압축된 노트북을 전송하고, 전송받은 노트북을 새 창에서 여는 채널을 생성합니다.
In[7]:=

CreateChannel["nb", ChannelPreSendFunction -> (Compress[#1] &),
HandlerFunctions ->
Association[
"MessageReceived" -> (CreateWindow[Uncompress[#Message]] &)]]
Out[7]=

채널로 수신하기 시작합니다.
In[8]:=

listener = ChannelListen["nb"]
Out[8]=

노트북을 생성하고 채널에 전송합니다.
In[9]:=

nb = DocumentNotebook[{TextCell["My Report", "Section"],
TextCell["Lorem ipsum dolor sit amet:", "Text"],
ExpressionCell[
ContourPlot[x + Sin[x^2 + y^2], {x, -4, 4}, {y, -4, 4},
Contours -> 9, ContourShading -> ColorData[35, "ColorList"]]]},
StyleDefinitions -> FrontEnd`FileName[{"Article"}, "Preprint.nb"],
WindowTitle -> "My Report", Background -> LightOrange]
Out[9]=

In[10]:=

ChannelSend["nb", nb]
Out[10]=

받은 노트북을 살펴봅니다.
Out[11]=
