Methods

Dive deeper into the methods at your disposal in the ALO Javascript Presence SDK.

Constructor

Presence

new Presence({
    authToken: "xxx",
    projectId: "myproject",
    userId: "alpha",
    deviceId: "device-1"
})

Once initialized, the user is automatically connected to the presence service.

Parameters:

Methods

.hereNow()

.hereNow({ userIds: [string] });

Fetch the current online/offline status for a list of users.

Parameters:

.subscribe()

.subscribe({ userIds: [string] });

Subscribe to online/offline events for a list of users. If called more than once it will not unsubscribe from user ids made in previous calls. It will only subscribe to the user ids not already subscribed.

Parameters:

.unsubscribeAll()

.unsubscribeAll();

Unsubscribe from all online/offline events.

.watch()

.watch(callback: function)

Register a callback function to recieve online/offline events subscribed to with .subscribe().

Parameters:

.unwatchAll()

.unwatchAll();

Unregister all callbacks registered with .watch().

.disconnect()

.disconnect()

Disconnects the user from the presence service and unsubscribes and unwatches all events.

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved