Options
Menu

Class PresenceService

The PresenceService is the main entry point into Convergence's User Presence subsystem. User Presence tracks the availability and state of Domain Users within the System. Users are generally available or not if they have at least one session that is connected. Each user in the system can set presence state. Presence state is global for each user in that the state is shared across all sessions.

See the developer guide for additional background.

See PresenceServiceEvents for the events that may be emitted on this service.

Hierarchy

Index

Methods

addListener

clearState

  • clearState(): void
  • Deletes all items in the local user's presence state.

    Returns void

events

  • Provides the events emitted by this object as an Observable stream.

    example
    
    eventEmitter.events()
      .filter(e => e.name === "myevent")
      .subscribe(e => console.log(e));
    

    Returns Observable<IPresenceEvent>

    An Observable stream of all events emitted by this object.

isAvailable

  • isAvailable(): boolean
  • Determines if the local user is available.

    Returns boolean

    True if the local user is available, false otherwise.

off

on

once

  • Adds a single shot event listener for the specified event. The listener will be called the first time the specified event is fired after the event registration occurs, after which the registration will be removed and no further events will be passed to the listener.

    Parameters

    Returns ConvergenceEventEmitter<IPresenceEvent>

    This object, in support of a fluent API.

presence

removeAllListeners

removeListener

removeListeners

removeState

  • removeState(key: string): void
  • removeState(keys: string[]): void
  • Removes the key-value pair of the provided key on the local user's presence state.

    Parameters

    • key: string

      an existing key in the local user's presence state

    Returns void

  • Removes all the entries in the local user's presence state matching the provided array of keys.

    Parameters

    • keys: string[]

      an array of keys

    Returns void

session

setState

  • setState(state: StringMapLike): void
  • setState(key: string, value: any): void
  • Sets the given items on the local user's presence state.

    Parameters

    • state: StringMapLike

      a Map or object literal whose keys are Strings.

    Returns void

  • Sets a single key-value pair on the local user's presence state.

    Parameters

    • key: string

      the new pair's key

    • value: any

      the new pair's value

    Returns void

state

  • state(): Map<string, any>
  • Returns a Map representing the local user's presence state.

    Returns Map<string, any>

    a Map of the local user's presence state

subscribe

Object literals

Events

Events: object

A mapping of the events this service could emit to each event's unique name. Use this to refer an event name:

presenceService.on(PresenceService.Events.STATE_SET, function listener(e) {
  // ...
})

AVAILABILITY_CHANGED

AVAILABILITY_CHANGED: string = PresenceAvailabilityChangedEvent.NAME

STATE_CLEARED

STATE_CLEARED: string = PresenceStateClearedEvent.NAME

STATE_REMOVED

STATE_REMOVED: string = PresenceStateRemovedEvent.NAME

STATE_SET

STATE_SET: string = PresenceStateSetEvent.NAME