aboutsummaryrefslogtreecommitdiff
path: root/docs/api/websockets.md
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-04-13 18:26:45 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-13 18:26:45 -0700
commit011e157cac7698050370e24495a9002dacfceea9 (patch)
treeebb561dbda3e8f67302cc4d5b398f4a2744f7884 /docs/api/websockets.md
parent0cc56e8efce9c7d4905b3649827bf9b40a677b25 (diff)
downloadbun-011e157cac7698050370e24495a9002dacfceea9.tar.gz
bun-011e157cac7698050370e24495a9002dacfceea9.tar.zst
bun-011e157cac7698050370e24495a9002dacfceea9.zip
Docs restructuring (#2638)
* Restructure * Update nav * Reorg * Reshuffle ecosystem pages * Split up runtime/runtime * Back to runtime/index * Fix issue * Split up runtime/index * Add Writing Tests page * Prettier matcher table * More updates
Diffstat (limited to 'docs/api/websockets.md')
-rw-r--r--docs/api/websockets.md4
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.