apollographql / subscriptions-transport-ws

:arrows_clockwise: A WebSocket client + server for GraphQL subscriptions
https://www.npmjs.com/package/subscriptions-transport-ws
MIT License
1.52k stars 342 forks source link

Support multiple GraphQL servers on the same http server #776

Closed Yogu closed 2 years ago

Yogu commented 4 years ago

Currently, to my understanding, you can not create multiple SubscriptionServer instances on the same http.Server, even if they have different paths configured. If you do this, all WebSocket connections will be aborted instantly by the one or the other server because the path in the URL does not match their expected path. The ws package maintainers see it out-of-scope to handle this transparently and link to the documentation on how to do it. I don't think users of subscription-transport-ws could follow this guideline, so it needs to be implemented here. What do you think?

Yogu commented 4 years ago

After looking further into this, it looks like subscriptions-transport-ws basically supports this, and it's missing in ApolloServer: https://github.com/apollographql/apollo-server/issues/4336