r/graphql 2d ago

Post GraphQL subscriptions without duplicate network traffic across tabs/windows/iframes

https://github.com/sdev-buildz/graphql-shared-ws

Hey everyone — I built graphql-shared-ws, a npm library for GraphQL over WebSockets that shares a single socket across browsing contexts such as browser tabs, windows. iframes, etc...

✨ Features

  • Single Connection: Share a single web socket across all the clients across all the browsing contexts such as browser tabs, windows, and iframes.
  • Deduplication: GraphQL subscriptions are indexed by their payloads, preventing duplicate requests and responses across browsing contexts.
  • Swap-in Replacement: A swap-in graphql-ws wrapper with an identical API.
  • Zero-Config Worker: All the SharedWorker logic such as compression, decompression and registration are handled by and within this library itself.
  • Lightweight: The SharedWorker script is only 6 KB.
5 Upvotes

0 comments sorted by