pusher / pusher-websocket-react-native

React Native official Pusher SDK
MIT License
61 stars 52 forks source link

Custom onEvent callback on different screens #156

Closed antonzeno closed 4 months ago

antonzeno commented 4 months ago

Hey what is the best way to handle events dynamically. for example on chat list I want to have some logic handling events caught on onEvent, and on single chat page I want to have some other logic. Right now I have created a provider in which I handle pusher connections, and the subscriptions are then handled dynamically on each screen. but the onEvent callback is passed only once on pusher init.

Right now I am emmiting custom events from inside the onEvent and subscribing to those then pass a specific callback to handle screen logic. was just wondering if there is any better approach provided by library

antonzeno commented 4 months ago

Closing issue. Could be done passing onEvent callback on channel subscription.