Allow useServer
of ws
to supports other subprotocols
#582
-
StoryMy backend supports both the graphql-transport-ws subprotocol and general WebSocket use cases, such as a channel for game event subscriptions without using GraphQL. I think it could be made more extendable by allowing a boolean flag to prevent overriding the server's handleProtocols. Alternatively, passing a list of supported protocols to options and handling them through the library's handleProtocols might also be helpful. Acceptance criteria
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I also noticed that Here is my temporary patch: https://github.com/cocrafts/UnderRealm/blob/feat/game-play-subscription/.yarn/patches/graphql-ws-npm-5.16.0-98146e34fe.patch |
Beta Was this translation helpful? Give feedback.
-
The graphql-ws library is only to be used for the GraphQL over WebSocket protocol, so supporting other subprotocols makes no sense. If you want to run multiple WS servers where one handles GraphQL stuff and the other non-GraphQL, you can run multiple WS server instances each handling its duties. Please advise the "ws server usage with subscriptions-transport-ws backwards compatibility" recipe to get an idea on how to run multiple WS servers. |
Beta Was this translation helpful? Give feedback.
The graphql-ws library is only to be used for the GraphQL over WebSocket protocol, so supporting other subprotocols makes no sense.
If you want to run multiple WS servers where one handles GraphQL stuff and the other non-GraphQL, you can run multiple WS server instances each handling its duties. Please advise the "ws server usage with subscriptions-transport-ws backwards compatibility" recipe to get an idea on how to run multiple WS servers.