diff options
Diffstat (limited to 'docs/api/websockets.md')
-rw-r--r-- | docs/api/websockets.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/api/websockets.md b/docs/api/websockets.md index f04d10fc6..0c40a05c0 100644 --- a/docs/api/websockets.md +++ b/docs/api/websockets.md @@ -12,7 +12,7 @@ Internally Bun's WebSocket implementation is built on [uWebSockets](https://github.com/uNetworking/uWebSockets). {% /callout %} -## Create a client +## Connect to a WebSocket server To connect to an external socket server, create an instance of `WebSocket` with the constructor. @@ -46,7 +46,7 @@ socket.addEventListener("close", event => {}); socket.addEventListener("error", event => {}); ``` -## Create a server +## Create a WebSocket server Below is a simple WebSocket server built with `Bun.serve`, in which all incoming requests are [upgraded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) to WebSocket connections in the `fetch` handler. The socket handlers are declared in the `websocket` parameter. |