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?


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.

1 Like

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.

1 Like

Thank you both, that answers my question. For now I am re-fetching the data on reconnect, but I will look into an alternative pubsub in the future. Cheers :slight_smile: