-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastify websockets breaking change #553
Comments
Hey hey, thanks for reporting this! We could detect the socket location during runtime, but the hard part is actually the TS types... IDK how to approach this. Maybe release a new major version of graphql-ws that has no support for the legacy fastify? What do you think? |
It may be better yes, a runtime check doesn't feel right. |
@enisdenjo would you be open to having v10 support behind a config option? e.g. When the config option is used, the extra data can switch from providing This would keep functionality the same for v9 and below while allowing v10 and above to be supported with only a minor release as these changes are technically not a breaking change due to having to explicitly opt-in. Example usage for v10: fastify.get('/graphql', { websocket: true }, makeHandler({ schema, rawWebSocket: true })); |
@charsleysa the issue is not only in runtime, but also with TS types - they dont work when using the latest fastify websockets. |
Just hit this. Rock and hard place. A new major doesn't seem appropriate - unless coming with other things. New sub folder would work, but is a maintenance burden. Separately library allows for appropriate major bumps but is a maintenance burden - at least setup. |
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 nowWebSocket
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:
I'm concerned about how to properly propagate errors for the newly created stream.
The text was updated successfully, but these errors were encountered: