Wolfram 언어

채널 프레임워크

임의의 내용을 담은 인스턴트 메시징

데스크톱 세션에서 인스턴트 메시징 데모 채널 ("WIM")를 생성하는 패키지를 로드하고 수신을 시작합니다.

In[1]:=
Click for copyable input
Needs["DemoChannels`WIM`"]

자신의 WIM 채널을 만들고 이를 수신하기 시작합니다.

In[2]:=
Click for copyable input
channel = CreateWIMChannel[]
Out[2]=
In[3]:=
Click for copyable input
listener = ChannelListen[channel]
Out[3]=

자신에게 WIM을 전송하고 새로운 대화 노트북에 자신의 메시지가 표시되는지 확인합니다.

In[4]:=
Click for copyable input
ChannelSend["WIM", "Hi there."]
Out[4]=
Out[5]=

현재 노트북을 메시지에 첨부합니다.

In[6]:=
Click for copyable input
ChannelSend["WIM", {"Sending a notebook.", InputNotebook[]}]
Out[6]=
Out[7]=

전체 채널을 참조하여 다른 Wolfram 언어 사용자도 WIM에 보낼 수 있습니다.

In[8]:=
Click for copyable input
yourWIM = $WolframID <> ":WIM"
Out[8]=
In[9]:=
Click for copyable input
ChannelSend[yourWIM, "hello"]
Out[9]=

또는 자신의 WIM URL을 오픈합니다.

In[10]:=
Click for copyable input
listener["URL"]
Out[10]=
In[11]:=
Click for copyable input
listener["URL"]; ChannelSend[%, "another message"]
Out[11]=

누구나 웹 브라우저에서 (또는 다른 어떤 HTTP 클라이언트로부터) HTTP 요청을 다음의 URL로 함으로써 메시지를 보낼 수있습니다.

In[12]:=
Click for copyable input
URLBuild[listener["URL"], {"operation" -> "send", "Message" -> "yet another message"}]
Out[12]=
In[13]:=
Click for copyable input
URLBuild[listener["URL"], {"operation" -> "send", "Message" -> "yet another message"}]; URLFetch[%]
Out[13]=

다른 사용자로부터 들어오는 메시지에 회신하려면, 사용자 채널의 통신을 인증합니다.

In[14]:=
Click for copyable input
Unprotect[$AllowExternalChannelFunctions]; $AllowExternalChannelFunctions = True;

수신을 중지하고 보안 설정을 취소합니다.

In[15]:=
Click for copyable input
RemoveChannelListener[listener]
Out[15]=
In[16]:=
Click for copyable input
$AllowExternalChannelFunctions = False; Protect[$AllowExternalChannelFunctions];

관련 예제

de en es fr ja pt-br ru zh