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.

See the developer guide for an introduction to Activities.

### Hierarchy

- ConvergenceEventEmitter<IActivityEvent>
  - ActivityService

## Index

### Methods

- addListener
- events
- isJoined
- join
- joined
- off
- on
- once
- removeAllListeners
- removeListener
- removeListeners
- session

## Methods

### addListener

- addListener(event: string, listener: ConvergenceEventListener<IActivityEvent>): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.addListener

  Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

  #### Parameters

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IActivityEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### events

- events(): Observable<IActivityEvent>

- Inherited from ConvergenceEventEmitter.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

- join(id: string, options?: IActivityJoinOptions): Promise<Activity>

- 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

- joined(): Map<string, Activity>

- Provides a map of all currently joined Activities.

  #### Returns Map<string, Activity>

  A Map of Activity Id => Activity.

### off

- off(event: string, listener: ConvergenceEventListener<IActivityEvent>): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.off

  Removes a single event listener for a specific event.

  #### Parameters

  - ##### event: string

    The name of the event to remove the listener for.

  - ##### listener: ConvergenceEventListener<IActivityEvent>

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### on

- on(event: string, listener: ConvergenceEventListener<IActivityEvent>): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.on

  Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

  #### Parameters

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IActivityEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### once

- once(event: string, listener: ConvergenceEventListener<IActivityEvent>): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.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

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IActivityEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### removeAllListeners

- removeAllListeners(): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.removeAllListeners

  Removes all listeners for all events. This is useful for cleanup before disposing of this particular event emitter.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### removeListener

- removeListener(event: string, listener: ConvergenceEventListener<IActivityEvent>): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.removeListener

  Removes a single event listener for a specific event.

  #### Parameters

  - ##### event: string

    The name of the event to remove the listener for.

  - ##### listener: ConvergenceEventListener<IActivityEvent>

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### removeListeners

- removeListeners(event: string): ConvergenceEventEmitter<IActivityEvent>

- Inherited from ConvergenceEventEmitter.removeListeners

  Removes all listeners bound on the given event.

  #### Parameters

  - ##### event: string

    the name of the event to remove listeners for

  #### Returns ConvergenceEventEmitter<IActivityEvent>

  This object, in support of a fluent API.

### session

- session(): ConvergenceSession

- #### Returns ConvergenceSession

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