Hi, trying to use elixir/phoenix/absinthe on the backend and nextjs with typescript on the frontend. Everything seems to be well except that Absinthe/graphql subscriptions seem to be abandoned, outdated corejs, etc. If you are doing subscriptions is there another way ?
I’ll have to implement GraphQL subscriptions in my codebase soon.
I assume that you refer to the package
absinthe-socket. I didnt look into it yet but can’t we just use the native JS WebSocket object?
I have a repo on GitHub which allows you to use the Apollo GraphQL client to talk to Absinthe on the back end. Unfortunately, though, I’ve never used it in production and it may be incomplete or out-of-date. But it’s there if you care to look at it: GitHub - easco/absinthe_apollo_sockets: Use the Apollo Websocket protocol to drive Absinthe GraphQL functionality
Thank you for sharing this lib!
If I understand right, this library allows Absinthe to follow the
graphql-ws protocol. Two questions:
Absinthe by default then doesn’t follow the protocol? Why not, as graphql-ws is becoming the standard from what I read?
This library only seems to handle the server-side implementation of the protocol, right? What should I use client-side? (I do not want to use a specific framework like Apollo).
I think in the future Absinthe might very well use
graphql-ws as the default. Especially as more clients will support it by default.
In regards to your second question, a JS client without Apollo et al. is here: GitHub - enisdenjo/graphql-ws: Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. This is the base client that e.g. Apollo have wrappers for.
Thank you for your help! I got confused that
graphql-ws has also code for the server. It’s a pity that it is not separated into two packages, as if you don’t run the server on NodeJS, you only need the client-specific code.