+ Start a Discussion
Saurabh Kulkarni 84Saurabh Kulkarni 84 

Subscribe to Generic Events automatically in aura component

I'm using streaming API generic event which can be fired from Streaming REST API. A Lightning aura component is acting as listener with EMP API to subscribe and receive the event. Now, my component is meant to show a toast for any generic message. The user can be on home tab or opportunity or lead or  anywhere. I want him to be subscribed to the channel so that the user can see toast being fired by the streaming api.

I had added my component to home tab and when user loads home tab for first time, he/she is subscribed to it. But when someone while being on some other tab reloads the whole page, then subscription is gone and user can't see the toast.

I want to know if there is a way by which I can make an user subscribed to a streaming channel all the time from login time till logout?