From 011e157cac7698050370e24495a9002dacfceea9 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Thu, 13 Apr 2023 18:26:45 -0700 Subject: 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 --- docs/api/websockets.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api/websockets.md') 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. -- cgit v1.2.3