=== For App Developers ===
Using presence in you application is done by: # including extra information in your app manifest# registering your app in the Presence service to receive notifications# Decide if you want to use the stream API or to get notified via a webhook# add a Presence doorhanger into your application so user can grant you access to their Presence info ==== Changes to the app manifest ==== An app developer wishes to get presence information, the following can be addd added to the app manifest:
{
to the app.
==== Register the app in Mozilla Presence ==== The application developer must register their application separately with Mozilla Presence and . XXX define the registering API here ==== WebHook ==== It may optionally set a "Webhook URL"that will be called with presence updates for users that look like the following:
POST /some/webhook/callback
["UID4828382", "online"]
]}
In case the WebHook was not set by the application, updates have to be requested by using the
stream API, as explained in the next section.
==== Stream ====
When the application is registered, it gets back a unique application id <appid>.
This <appid> can be used to get a stream of presence updates by calling "GET <appid>/presence.json"
This will return a stream of presence updates for usersthat look like the following:
GET <appid>/presence.json
{[
["UID2949293", "away"],
["UID4823888", "online"],
["UID482838", "offline"],
["UID4828382", "online"]
]}
The application can consume the resulting stream for as long as is practical. The Presence server will
hold the connection open indefinitely,
barring server-side error, excessive client-side lag, network hiccups, routine
server maintenance or duplicate logins.
==== Setting up a doorhanger ====
When the user grants access, your application will get a unique ID that you should associate with the user record