Closed AntonioA-D-C closed 6 months ago
You're supposed to return a cleanup function in useCallback that unsubscribes from the channel
Do you see any log output from your code when changing screen? I can see several log statements in your sample, and would be interested to see what the behaviour is when this issue is encountered.
Looks to have been resolved https://github.com/pusher/pusher-websocket-react-native/issues/111#issuecomment-1959328185
I tried the advice I got in my other post where I couldn't find out exactly why the package was sometimes working and sometimes not, about storing it in a context causing unexpected behaviour
So I stopped storing it i n a context, and made it more or less how the examples in the page show.
Now I noticed it worked more consistently, however, thanks to working more consistently, I noticed when I changed screens, and went back to my original screen, the service stopped working, it could no longer receive messages.
Here's an example: