Class: SubscriptionRequest

SubscriptionRequest(entityTypenon-null, clientnon-null, actorRequestFactorynon-null)

A request to subscribe to updates of entity states of a certain type. Allows to obtain the `EntitySubscriptionObject` which exposes the entity changes in a form of callbacks which can be subscribed to. A usage example: ``` client.subscribeTo(Task.class) .where(Filters.eq("status", Task.Status.ACTIVE)) // Additional filtering can be done here. .post() .then(({itemAdded, itemChanged, itemRemoved, unsubscribe}) => { itemAdded.subscribe(_addDisplayedTask); itemChanged.subscribe(_changeDisplayedTask); itemRemoved.subscribe(_removeDisplayedTask); }); ``` If the entity matched the subscription criteria at one point, but stopped to do so, the `itemRemoved` callback will be triggered for it. The callback will contain the last entity state that matched the subscription. Please note that the subscription object should be manually unsubscribed when it's no longer needed to receive the updates. This can be done with the help of `unsubscribe` callback.

Constructor

new SubscriptionRequest(entityTypenon-null, clientnon-null, actorRequestFactorynon-null)

Parameters:
Name Type Description
entityType Class.<Message> the target entity type
client Client the client which initiated the request
actorRequestFactory ActorRequestFactory the request factory
Source:

Classes

SubscriptionRequest

Methods

_self()

Source:

_subscribe() → {Promise.<EntitySubscriptionObject.<Message>>}

Source:
Returns:
Type
Promise.<EntitySubscriptionObject.<Message>>