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
fix: provide websocket instead of stream to avoid potential backpressure issues (#289) (#290)
* fix: provide websocket instead of stream to avoid potential backpressure issues (#289)
* chore: update documentation and tests
* chore: update documentation to include an example of using createWebSocketStream
* chore: update failing unit test
@@ -93,10 +93,10 @@ It is important that websocket route handlers attach event handlers synchronousl
93
93
Here is an example of how to attach message handlers synchronously while still accessing asynchronous resources. We store a promise for the async thing in a local variable, attach the message handler synchronously, and then make the message handler itself asynchronous to grab the async data and do some processing:
@@ -350,15 +375,6 @@ _**NB** The `path` option from `ws` should not be provided since the routing is
350
375
351
376
_**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_
352
377
353
-
You can also pass the following as `connectionOptions` for [createWebSocketStream](https://github.com/websockets/ws/blob/master/doc/ws.md#createwebsocketstreamwebsocket-options).
354
-
355
-
-`allowHalfOpen` <boolean> If set to false, then the stream will automatically end the writable side when the readable side ends. Default: true.
356
-
-`readable` <boolean> Sets whether the Duplex should be readable. Default: true.
357
-
-`writable` <boolean> Sets whether the Duplex should be writable. Default: true.
358
-
-`readableObjectMode` <boolean> Sets objectMode for readable side of the stream. Has no effect if objectMode is true. Default: false.
359
-
-`readableHighWaterMark` <number> Sets highWaterMark for the readable side of the stream.
360
-
-`writableHighWaterMark` <number> Sets highWaterMark for the writable side of the stream.
361
-
362
378
[ws](https://github.com/websockets/ws) does not allow you to set `objectMode` or `writableObjectMode` to true
@@ -187,20 +178,20 @@ function fastifyWebsocket (fastify, opts, next) {
187
178
// within the route handler, we check if there has been a connection upgrade by looking at request.raw[kWs]. we need to dispatch the normal HTTP handler if not, and hijack to dispatch the websocket handler if so
0 commit comments