Is there a way to unsubscribe from Turbo StreamChannels after Devise logged out a user of inactivity?

45 views Asked by At

I have multiple Turbo Channels and when they steam data to a subscriber who is already logged out, because he was inactive, but he has not refreshed the page so he is still subscribed to the channel. When this happens i get errors in my console and i want to prevent that. But i cant find a way to either redirect the user after the session ended or to unsubscribe him form every Channel.

I already searched for some solutions and the redirect cant work because devise works server sided and not client sided so devise cant redirect a user. Moreover there is the dirty way with javascript and i dont want to go that way. There has to be a better solution maybe with a extra gem or something i cant get my head around.

0

There are 0 answers