SDK
SDK Android v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Constructors #

The Room object is the result of a subscription request, allowing you to manipulate the subscription itself.


Room(Collection, [options]) #

ArgumentsTypeDescription
Collectionobjectan instantiated Kuzzle Collection object
optionsobjectOptional subscription configuration

Options #

OptionTypeDescriptionDefault
volatileJSON ObjectAdditional information passed to notifications to other usersnull
scopestringFilter document notifications depending on their scope status. You may receive entering documents (scope: in), leaving documents (scope: out), all documents changes (scope: all) or filter these notifications completely (scope: none). This filter does not affect pub/sub messages or user events.all
statestringFilter document notifications depending on the state of the modifying request. You may receive real-time notifications when a document is about to be changed (state: pending), or be notified when the change has been fully written in the database (state: done), or both (state: all). This filter does not affect pub/sub messages or user events.done
subscribeToSelfboolean(Don't) subscribe to notifications fired as a consequence of our own queriestrue
usersstringFilter user notifications triggered upon a user entering the room (user: in), leaving the room (user: out), or both (user: all). Setting this variable to none prevents receiving these notificationsnone

Properties #

Property nameTypeDescriptionget/set
collectionstringThe subscribed collectionget
filtersJSON objectThe current set of filters of this roomget/set
headersJSON ObjectCommon headers for all sent documents.get/set
volatileJSON ObjectAdditional information passed to notifications to other usersget/set
subscribeToSelfboolean(Don't) subscribe to notifications fired as a consequence of our own queriesget/set
roomIdstringUnique room identifierget

Notes:

  • the headers property is inherited from the provided Collection object and can be overridden
  • updating the volatile property takes effect only after the subscription is renewed
  • by default, the global volatile properties are sent along with the subscription request. If a volatile option is provided during subscription, it will be merged with the global volatile for the subscription only. In case of conflicts, subscription volatile data takes priority over the global volatile ones.

Usage #

Room room = new Room(dataCollection);
RoomOptions options = new RoomOptions().setSubscribeToSelf(false);
Room room = new Room(dataCollection, options);