Skip to content

Commit 84f7875

Browse files
committed
Updating the README with connectionOptions details
1 parent 830bc99 commit 84f7875

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ fastify.listen(3000, err => {
238238

239239
`fastify-websocket` accept these options for [`ws`](https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback) :
240240

241-
- `objectMode` - Send each chunk on its own, and do not try to pack them in a single websocket frame.
242241
- `host` - The hostname where to bind the server.
243242
- `port` - The port where to bind the server.
244243
- `backlog` - The maximum length of the queue of pending connections.
@@ -257,6 +256,16 @@ _**NB** The `path` option from `ws` should not be provided since the routing is
257256

258257
_**NB** The `noServer` option from `ws` should not be provided since the point of fastify-websocket is to listen on the fastify server. If you want a custom server, you can use the `server` option, and if you want more control, you can use the `ws` library directly_
259258

259+
You can also pass the following as `connectionOptions` for [createWebSocketStream](https://github.com/websockets/ws/blob/master/doc/ws.md#createwebsocketstreamwebsocket-options).
260+
261+
- `allowHalfOpen` <boolean> If set to false, then the stream will automatically end the writable side when the readable side ends. Default: true.
262+
- `readable` <boolean> Sets whether the Duplex should be readable. Default: true.
263+
- `writable` <boolean> Sets whether the Duplex should be writable. Default: true.
264+
- `readableObjectMode` <boolean> Sets objectMode for readable side of the stream. Has no effect if objectMode is true. Default: false.
265+
- `readableHighWaterMark` <number> Sets highWaterMark for the readable side of the stream.
266+
- `writableHighWaterMark` <number> Sets highWaterMark for the writable side of the stream.
267+
268+
[ws](https://github.com/websockets/ws) does not allow you to set `objectMode` or `writableObjectMode` to true
260269
## Acknowledgements
261270

262271
This project is kindly sponsored by [nearForm](https://nearform.com).

0 commit comments

Comments
 (0)