A breaking change has been added to @fastify/websockets@10 (fastify/fastify-websocket#289). It breaks the fastify integration.
The wsHandler first parameter type is now WebSocket rather than a NodeJS stream.
To create a stream from it an explicit call to ws.createWebSocketStream(socket) is required.
A dirty patch to make it work with the new version:
wsHandler: (socket, req) => {
const connection = ws.createWebSocketStream(socket);
connection.socket = socket;
return wsHandler.call(_app, connection, req);
}
I'm concerned about how to properly propagate errors for the newly created stream.
A breaking change has been added to @fastify/websockets@10 (fastify/fastify-websocket#289). It breaks the fastify integration.
The
wsHandlerfirst parameter type is nowWebSocketrather than a NodeJS stream.To create a stream from it an explicit call to
ws.createWebSocketStream(socket)is required.A dirty patch to make it work with the new version:
I'm concerned about how to properly propagate errors for the newly created stream.