adam-h

adam-h

Absinthe subscription reconnection - resume rather than restart

I’m using Absinthe with the Apollo client, with a very similar setup to the Absinthe apollo guide.

When the client goes offline when there are active subscriptions (iPhone sleeping is the most obvious, but same with wifi disconnects on laptop), the subscriptions are recreated when the connection comes back up, rather than resuming the existing subscription (replaying missed messages) - which I was hoping for.

I assume this is intentional so the Absinthe server doesn’t need to maintain large queues for resuming connections which may have been offline for a while. But in case I am wrong, it would be great to know how to have these subscriptions resume rather than restart.

Am I correct in thinking this is working as designed, or am I missing something?

Cheers!

Marked As Solved

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

This is working as designed. Strictly speaking, the actual behaviour here is determined by the pubsub implementation you’re using, which isn’t hard coded into absinthe. Absinthe phoenix ships with an implementation based on phoenix pubsub, which relies on persistent phoenix channel connections to push messages. In theory you could build a different implementation that pushed into a persistent message bus.

Also Liked

maartenvanvliet

maartenvanvliet

This is not available in Absinthe afaik. You could probably track the missed messages yourself in a GenServer and publish them when the client reconnects.

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New

Other popular topics Top

SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement