Aktaeon

Aktaeon

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 ?

Showing Posts 1 to 7

thojanssens1

thojanssens1

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?

Aktaeon

Aktaeon OP

The elixir code seems to be up to date, but there are no updates on the JavaScript code needed for the sockets GitHub - absinthe-graphql/absinthe-socket: Core JavaScript support for Absinthe WS-based operations · GitHub no updates for several years and open pull request to update dependencies . But even with upgrading the depencies to newer versions will require more change in the code than just increasing the version number. Not sure how relevant that is but it has been complicating my project slightly :wink: lack of typescript does not help in my case. Probably all solvable but if there is an easier way I am interested in hearing about it :wink:

maartenvanvliet

maartenvanvliet

I recommend GitHub - absinthe-graphql/absinthe_graphql_ws: Add graphql-ws websocket transport for Absinthe · GitHub for absinthe websockets. It uses the graphql_ws protocol instead of absinthe over Phoenix channels that is used by absinthe_socket. It’s well supported by client libraries in JavaScript and other languages.

easco

easco

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 · GitHub

thojanssens1

thojanssens1

Thank you for sharing this lib!

If I understand right, this library allows Absinthe to follow the graphql-ws protocol. Two questions:

  1. Absinthe by default then doesn’t follow the protocol? Why not, as graphql-ws is becoming the standard from what I read?

  2. 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).

maartenvanvliet

maartenvanvliet

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. · GitHub This is the base client that e.g. Apollo have wrappers for.

thojanssens1

thojanssens1

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.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews