Our great sponsors
-
graphql-ws
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
-
apollo-server
🌍 Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
subscriptions-transport-ws
Discontinued :arrows_clockwise: A WebSocket client + server for GraphQL subscriptions
Have you thought about using graphql-ws instead? It uses the new graphql-transport-ws protocol which also has an open RFC that is discussed in the GraphQL working Groups.
It seems like onDisconnect is only invoked when the client destroys the WebSocket connection, thus you could ensure that the WebSocket connection is closed on the client after logging out (if that is a possible option) (https://github.com/apollographql/apollo-server/issues/1321).
Have you thought about using graphql-ws instead? It uses the new graphql-transport-ws protocol which also has an open RFC that is discussed in the GraphQL working Groups.
apollo-server plans to remove WebSocket support, which is currenlty done over the deprecated graphql-ws protocol (as implemented by the unmaintained subscription-transport-ws module by apollo), in the next major version.