Skip to content

Commit cf1d73b

Browse files
committed
structure/grammar fix
1 parent 5a12ac3 commit cf1d73b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/content/docs/workers/examples/websockets.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ async function handleRequest(request) {
9494
}
9595

9696
const webSocketPair = new WebSocketPair();
97-
const client = webSocketPair[0], // server-side WS endpoint in the worker
98-
server = webSocketPair[1]; // this is the remote from whoever connected to your worker-a browser client for example
97+
// This is the server-side WebSocket in the Worker.
98+
const client = webSocketPair[0],
99+
//This is the remote connection. For example, from a browser client.
100+
server = webSocketPair[1];
99101

100102
return new Response(null, {
101103
status: 101,
@@ -118,8 +120,10 @@ async fn fetch(req: HttpRequest, _env: Env, _ctx: Context) -> Result<worker::Res
118120
}
119121

120122
let ws = WebSocketPair::new()?;
121-
let client = ws.client; // server-side WS endpoint in the worker
122-
let server = ws.server; // this is the remote from whoever connected to your worker-a browser client for example
123+
// This is the server-side WebSocket in the Worker.
124+
let client = ws.client;
125+
// This is the remote connection. For example, from a browser client.
126+
let server = ws.server;
123127
server.accept()?;
124128

125129
worker::Response::from_websocket(client)

0 commit comments

Comments
 (0)