How can I unsubscribe from all topics (Absinthe subscriptions) upon logout?
Frontend (React & Apollo):
const logoutMutation = gql`
Backend (Phoenix & Absinthe):
def logout(user_id) do
def unsubscribe_all_topics(user_id) do
Subscriptions exist only as long as the websocket is alive. You can either track the various subscription handles you get back from the subscribe call, and call unsubscribe with each of them, or you can simply disconnect the websocket connection you sent the subscriptions over, and that will also automatically terminate all of them.
@benwilson512 Thanks a lot for your assistance!