mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
docs(websocket): change server port on example to default port (#2301)
Current example will fail without explicitly configure the server to use port 8080. Hence, replacing it with default port (3000).
This commit is contained in:
@@ -17,13 +17,13 @@ Internally Bun's WebSocket implementation is built on [uWebSockets](https://gith
|
||||
To connect to an external socket server, create an instance of `WebSocket` with the constructor.
|
||||
|
||||
```ts
|
||||
const socket = new WebSocket("ws://localhost:8080");
|
||||
const socket = new WebSocket("ws://localhost:3000");
|
||||
```
|
||||
|
||||
Bun supports setting custom headers. This is a Bun-specific extension of the `WebSocket` standard.
|
||||
|
||||
```ts
|
||||
const socket = new WebSocket("ws://localhost:8080", {
|
||||
const socket = new WebSocket("ws://localhost:3000", {
|
||||
headers: {
|
||||
// custom headers
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user