Closed mat-sz closed 6 months ago
@mcollina As discussed here https://github.com/fastify/fastify-websocket/issues/289#issuecomment-1973621926
I've removed stream creation completely. Another option here is to provide an object of shape { socket: WebSocket }
to provide compatibility with most common use cases.
Also, could be nice to provide a function to convert that socket into a stream; so the object could even be { socket: WebSocket; getStream: (opts?: DuplexOptions) => Promise<Duplex> }
.
I can update this PR to include either of the aforementioned solutions.
I don't think having a specific function is needed, let's just document how to create it using ws.
@mcollina I've added an example to README.md
CI is failing
@mcollina Resolved, for some reason the unit test was relying on the count of fastify log items to be constant, updated it to fail if level >= 50
instead.
Now
createWebSocketStream
is not called therefore there are no memory leaks/backpressure to worry about.Checklist
npm run test
andnpm run benchmark