LogoLogo
ALO.ai
Developer Documentation
Developer Documentation
  • Developer Documentation
  • Developer Account
    • API Key
  • SDKs
    • Authentication
    • Chat
      • Configuration
      • Send Messages
        • Upload Files
      • Message History
      • Message Actions
      • Message Counts
      • Translation
      • Typing Indicators
      • API Reference
        • Event
        • Message
    • Presence
      • Configuration
      • Basic Usage
      • Methods
    • Audio
      • Prerequisites
      • Instantiating Audio Service
      • Connect to a Channel
      • Disconnecting Audio Service
      • Push To Talk (PTT)
      • Full Duplex
      • Mute and Unmute Audio
      • Input/Output Device Selection
        • Microphone Selection
        • Speaker Selection
      • Channel Participants
      • Text To Speech Audio (TTS)
      • Automatic Reconnects
      • Handling Events
      • Classes
        • AloAudio
        • AudioUser
        • AudioChannel
        • Participant
    • Video
      • Prerequisites
      • Instantiating Video Service
      • Connect to a Channel
      • Disconnecting Video Service
      • Input Device Selection
        • Microphone Selection
        • Camera Selection
      • Publishing Streams
      • Modifying Published Streams
      • Channel Participants
      • Rendering Streams
        • Local Stream
        • Remote Streams
      • Muting/Unmuting Remote Streams
      • Recording Video (coming soon)
      • Automatic Reconnects
      • Handling Events
      • Classes
        • AloVideo
        • Participant
        • VideoChannel
        • VideoUser
  • ALO APPS
    • Overview
    • Creating Apps
    • Webhooks
      • Verifying Requests from ALO
    • Custom Action Forms
    • Using the ALO Platform API
  • ALO Platform API
    • Overview
    • Authentication
    • API
      • Actions and Periods
      • Channels
      • Channel Messages
      • Channel Users
      • Direct Message Channels
      • Direct Message Channel Chat Messages
      • Direct Message Channel Users
      • Groups
      • Periods
      • Types
      • Users
      • Video Management System
  • Misc
    • Supported Language Codes
Powered by GitBook
LogoLogo

ALO.ai

  • ALO.ai

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

On this page
  • Constructor
  • Presence
  • Methods
  • .hereNow()
  • .subscribe()
  • .unsubscribeAll()
  • .watch()
  • .unwatchAll()
  • .disconnect()
  1. SDKs
  2. Presence

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:

Name

Type

Required

Description

authToken

string

yes

The ALO generated auth token to grant access to the ALO presence service.

projectId

string

yes

The unique project ID associated with your app, provided by ALO.

userId

string

yes

A unique ID to associate the online/offline events with.

deviceId

string

no

An ID to differentiate multiple sessions or devices for the same userId. Multiple clients should not specify the same userId and deviceId pair.

Methods

.hereNow()

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

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

Parameters:

Name

Type

Required

Description

userIds

array[string]

yes

A list of user IDs to check online/offline status of.

.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:

Name

Type

Required

Description

userIds

array[string]

yes

A list of user IDs to subscribe to online/offline events.

.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:

Name

Type

Required

Description

callback

function

yes

A callback function that is called when a subscribed user ID presence event occurs.

.unwatchAll()

.unwatchAll();

Unregister all callbacks registered with .watch().

.disconnect()

.disconnect()

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

PreviousBasic UsageNextAudio

Last updated 8 months ago