Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
Cloud & Deployment
Core Language & Structure
Data Manipulation & Analysis
Engineering Data & Computation
External Interfaces & Connections
Financial Data & Computation
Geographic Data & Computation
Geometry
Graphs & Networks
Higher Mathematical Computation
Images
Knowledge Representation & Natural Language
Machine Learning
Notebook Documents & Presentation
Scientific and Medical Data & Computation
Social, Cultural & Linguistic Data
Strings & Text
Symbolic & Numeric Computation
System Operation & Setup
Time-Related Computation
User Interface Construction
Visualization & Graphics
Random Paclet
Alphabetical List
Using Paclets
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
WebSocketLink
Symbols
WebSocketConnect
WebSocketObject
WebSocketServerStart
ToneAr`WebSocketLink`
W
e
b
S
o
c
k
e
t
S
e
r
v
e
r
S
t
a
r
t
W
e
b
S
o
c
k
e
t
S
e
r
v
e
r
S
t
a
r
t
[
]
s
t
a
r
t
s
a
n
e
w
W
e
b
S
o
c
k
e
t
s
e
r
v
e
r
o
n
a
n
y
a
v
a
i
l
a
b
l
e
p
o
r
t
.
W
e
b
S
o
c
k
e
t
S
e
r
v
e
r
S
t
a
r
t
[
p
o
r
t
]
s
t
a
r
t
s
a
n
e
w
W
e
b
S
o
c
k
e
t
s
e
r
v
e
r
l
i
s
t
e
n
i
n
g
o
n
p
o
r
t
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
Examples
(
1
)
Basic Examples
(
1
)
Start a secure WebSocket server with an automatically generated localhost certificate:
I
n
[
1
]
:
=
s
e
r
v
e
r
=
W
e
b
S
o
c
k
e
t
S
e
r
v
e
r
S
t
a
r
t
[
3
0
0
0
0
,
"
T
L
S
"
T
r
u
e
]
Connect from a Wolfram client in the same kernel using WSS:
I
n
[
2
]
:
=
c
l
i
e
n
t
=
W
e
b
S
o
c
k
e
t
C
o
n
n
e
c
t
[
"
w
s
s
:
/
/
l
o
c
a
l
h
o
s
t
:
3
0
0
0
0
"
]
For browser testing, create or provide a certificate trusted by the browser. One common local-development workflow is mkcert:
mkcert -install
mkcert -pkcs12 localhost 127.0.0.1 ::1
Start the server with a trusted PKCS#12 certificate. Use the password for the generated certificate file; mkcert PKCS#12 files usually use "changeit".
I
n
[
3
]
:
=
s
e
r
v
e
r
=
W
e
b
S
o
c
k
e
t
S
e
r
v
e
r
S
t
a
r
t
[
3
0
0
0
0
,
"
T
L
S
"
T
r
u
e
,
"
C
e
r
t
i
f
i
c
a
t
e
"
{
"
l
o
c
a
l
h
o
s
t
+
2
.
p
1
2
"
,
"
c
h
a
n
g
e
i
t
"
}
]
A browser client can then connect with JavaScript if the certificate is trusted by the browser:
const ws = new WebSocket("wss://localhost:30000");
ws.onopen = () => ws.send("hello from browser");
Close the client and server when finished:
I
n
[
4
]
:
=
C
l
o
s
e
/
@
{
c
l
i
e
n
t
,
s
e
r
v
e
r
}
S
e
e
A
l
s
o
W
e
b
S
o
c
k
e
t
C
o
n
n
e
c
t
▪
W
e
b
S
o
c
k
e
t
O
b
j
e
c
t
"
"