The UserPresenceSubscription is a subscription to presence state and availability changes of a specific Domain User. The current state and availability can be queried from this object, OR you can use asObservable to subscribe to changes.

Instances of this can be obtained from PresenceService.subscribe.

Make sure to unsubscribe when you're done using this.

### Hierarchy

- ConvergenceEventEmitter<IPresenceEvent>
  - UserPresenceSubscription

## Index

### Accessors

- available
- state
- user

### Methods

- addListener
- asObservable
- events
- off
- on
- once
- removeAllListeners
- removeListener
- removeListeners
- unsubscribe

### Object literals

- Events

## Accessors

### available

- get available(): boolean

- Returns a boolean representing the associated user's current availabilty.

  #### Returns boolean

### state

- get state(): Map<string, any>

- Returns the associated user's current presence state.

  #### Returns Map<string, any>

### user

- get user(): DomainUser

- The user associated to this presence subscription.

  #### Returns DomainUser

## Methods

### addListener

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

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

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### asObservable

- asObservable(): Observable<UserPresence>

- Returns this presence subscription as an RxJS Observable.

  #### Returns Observable<UserPresence>

### events

- events(): Observable<IPresenceEvent>

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

  An Observable stream of all events emitted by this object.

### off

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

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

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### on

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

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

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### once

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

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

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### removeAllListeners

- removeAllListeners(): ConvergenceEventEmitter<IPresenceEvent>

- Inherited from ConvergenceEventEmitter.removeAllListeners

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

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### removeListener

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

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

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IPresenceEvent>

  This object, in support of a fluent API.

### removeListeners

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

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

  This object, in support of a fluent API.

### unsubscribe

- unsubscribe(): void

- Unsubscribes from future presence changes for the associated user, cleaning up any needed resources.

  #### Returns void

## Object literals

### StaticEvents

Events: object

A mapping of the events a subscription could emit to each event's unique name.

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