Server: Pusher gem(rails) Client: Pusher Swift
How do I detect if the client is gone offline(app in background) or come back online(app in foreground) using Pusher gem?
What I want to achieve is sending APN to the client, when the client enters background without querying client online flag(s).
Is it possible to achieve this? Is there way to check the status of Event trigger if the message was received by client or not?
Thanks
There are a few ways you can achieve what you're trying to do.
If you're using a single channel per client you can use the
channel_existencewebhooks as described here. As each channel is limited to a single user, you will receive achannel_vacatedwebhook whenever your client goes offline and achannel_occupiedwebhook whenever your client comes online.If you're not using a single channel per client, you could usepresence channels and webhooks. You can configure a
member_added/member_removedwebhook every time a user joins/leaves a channel. There is an additional message overhead associated with this, as each user in the channel will also receive amember_added/member_removedwebhook over the websocket connection.