Search code examples
pubnub

Calling a web service on PubNub Presence events


When using the PubNub Presence feature, is it possible to provide a HTTP callback that PubNub calls when a user joins or leaves a channel? In my case I want to call a Parse.com cloud function. To clarify: I don't want to call the function from a client, but have the PubNub.com servers take care of it.


Solution

  • Calling a web service on PubNub Presence events

    PubNub offers Presence "HTTP Callback" generated from PubNub.com servers. You must ask your Account Manager to enable for you; send an email to [email protected] to enable. Ask for "Presence Callback Active" and "Presence Callback Inactive" settings. You'll want to setup a dev/prod key pair to point the WebHook URLs at different environments.

    The HTTP callback URL that is triggered when a channel becomes active.

    Webhooks are now supported for all presence events: join, leave, timeout and state-change, as well as the channel active and inactive events.

    For a full explanation please read this StackOverflow about PubNub Presence Webhooks and how to get them configured for you keys.