Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ActivityService

The ActivityService provides the main entry point into working with Activities in Convergence. Activities provide a mechanism to communicate where users are operating within a system and what they are doing.

Hierarchy

Index

Methods

addListener

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<IActivityEvent>

    An Observable stream of all events emitted by this object.

isJoined

  • isJoined(id: string): boolean
  • Determines if an Activity with the specified id is already joined.

    Parameters

    • id: string

      The id of the Activity to check.

    Returns boolean

    True if the Activity with the specified id is joined; false otherwise.

join

  • Allows the connected user to join the specified activity.

    const activityId = "myActivityId";
    activityService
      .join(activityId)
      .then(activity => {
        console.log("Joined!");
        console.log(activity.participants());
      });
      .catch(e => console.error(e));

    Parameters

    • id: string

      The unique id of the Activity to join.

    • Optional options: IActivityJoinOptions

      Options for connecting to the specified Activity.

    Returns Promise<Activity>

    A Promise that will be resolved with the successfully joined Activity.

joined

  • Provides a map of all currently joined Activities.

    Returns Map<string, Activity>

    A Map of Activity Id => Activity.

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<IActivityEvent>

    This object, in support of a fluent API.

removeAllListeners

removeListener

removeListeners

session

  • Returns ConvergenceSession

    The current Convergence ConvergenceSession object that represents the connection to the Convergence Domain.