question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for the graphql-transport-ws GraphQL over WebSocket Protocol

See original GitHub issue

Currently our ASGI and AIOHTTP integrations only support the “legacy” graphql-ws websocket subprotocol. Its repository states:

The subscriptions-transport-ws library is not being actively maintained. It is recommended that you use the graphql-ws library instead. For details read the GraphQL over WebSockets announcement.

Just for clarification: the legacy graphql-ws websocket subprotocols library is called “subscriptions-transport-ws”, while the newer graphql-transport-wswebsocket subprotocols library is called “graphql-ws”. Yep, slightly confusing.

According to NPM download stats the legacy library is still downloaded more often than the new library. Since both protocols are incompatible I propose we support both for now and give users a choice to disable them individually.

I already implemented the new protocol for our AIOHTTP integration, which went very well since the new protocol is way better documented than the old one. I’m currently working on tests and a good abstraction that allows us to reuse the code for the ASGI integration. I’ll finish work on this next week.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Speedy1991commented, Sep 13, 2021

we use graphql-transport-ws in combination with starlette & django - works really nice. I’m not sure if supporting the old library/spec makes sense, because the backend code is so much different and there is not much in common.

I think many downloads on the old library are coming from the very first tutorials with subscriptions (which ar quite popular). A good subscription example with the new protocol in the strawberry documentation would make much more sense IMO.

0reactions
jkimbocommented, Oct 2, 2021

Thats a really interesting setup, thanks @Speedy1991

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL over WebSockets – The Guild
Coherent, zero-dependency, lazy, simple, server and client implementation of the new, security first, GraphQL over WebSocket Protocol.
Read more >
graphql-ws/PROTOCOL.md at master - GitHub
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. - graphql-ws/PROTOCOL.md at master ...
Read more >
WebSocket Link - Apollo GraphQL Docs
Execute subscriptions (or other operations) over WebSocket with the subscriptions-transport-ws library.
Read more >
GraphQL with WebSocket Protocol and Subscriber - XenonStack
GraphQL with Web Socket Protocol and Subscriber to receive several necessary ... with React js, and the larger Apollo community supports ...
Read more >
graphql-ws - npm
... GraphQL over WebSocket Protocol compliant server and client. ... import { WebSocketServer } from 'ws'; // yarn add ws // import ws...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found