You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/patterns/websocket.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,9 @@ head:
15
15
---
16
16
17
17
# WebSocket
18
-
Elysia WebSocket is extending Bun WebSocket which use[uWebSocket](https://github.com/uNetworking/uWebSockets) under the hood.
18
+
Elysia WebSocket extends Bun's WebSocket which uses[uWebSocket](https://github.com/uNetworking/uWebSockets) under the hood.
19
19
20
-
To start using WebSocket, register the WebSocket plugin, and start declaring WebSocket route with `.ws`.
20
+
To start working with a WebSocket, register the Elysia WebSocket plugin, and declare a WebSocket route with `.ws`.
21
21
```typescript
22
22
import { Elysia, ws } from'elysia'
23
23
@@ -31,14 +31,14 @@ new Elysia()
31
31
.listen(8080)
32
32
```
33
33
34
-
WebSocket route is extending Bun WebSocket configuration, for additional configuration please refers to [Bun's WebSocket](https://bun.sh/docs/api/websockets).
35
34
36
-
Just like normal route, WebSocket also accepts **schema** to strictly type and validate requests.
35
+
Just like normal route, WebSockets also accepts a **schema** object to strictly type and validate requests.
37
36
38
37
## Configuration
39
-
This plugin extends config from [Bun WebSocket](https://github.com/oven-sh/bun#websockets-with-bunserve)
40
38
41
-
Below is a config extends from [Bun WebSocket](https://github.com/oven-sh/bun#websockets-with-bunserve)
39
+
Elysia's WebSocket plugin extends Bun's WebSocket configuration so if you wish to configure the websocket you can refer to [Bun's WebSocket documentation](https://bun.sh/docs/api/websockets) to learn more about this.
40
+
41
+
Below is a config that extends from [Bun WebSocket](https://github.com/oven-sh/bun#websockets-with-bunserve)
42
42
43
43
### perMessageDeflate
44
44
@default`false`
@@ -65,11 +65,11 @@ The maximum number of bytes that can be buffered for a single connection.
65
65
66
66
Close the connection if the backpressure limit is reached.
67
67
68
-
## Method
69
-
Below are the new methods register by the plugin
68
+
## Methods
69
+
Below are the new methods that are available to the WebSocket plugin
0 commit comments