why deepstreamHub? compare us getting started feature roadmap faq
use cases pricing
blog contact

The factory method's for deepstreamHub's realtime datastore concepts, such as getRecord(recordName), getList(listName), provider functionality such as listen(eventName,listener) and single requests like snapshot(recordName)



Record getRecord(String recordName)
argument type description
recordName String The name of the record to get

Returns an existing record or creates a new one. If creating a new one the record will not be in a ready state till it is loaded from the server.

Show example...


List getList(String listName)
argument type description
listName String The name of the list to retrieve

Returns an existing List or creates a new one. A list is a specialised type of record that holds an array of recordNames.

Show example...


AnonymousRecord getAnonymousRecord()
Returns an AnonymousRecord. An anonymous record is effectively a wrapper that mimicks the API of a record, but allows for the underlying record to be swapped without losing subscriptions etc. This is particularly useful when selecting from a number of similarly structured records. E.g. a list of users that can be choosen from a list. The only API differences to a normal record is an additional setName(name) method.


SnapshotResult snapshot(String recordName)
argument type description
recordName String The name of the record which data to retrieve

Retrieves a SnapshotResult with the current record data. Using this doesn't subscribe the client to changes the way getRecord(name) does.

Show example...


boolean has(String recordName) throws DeepstreamError
argument type description
recordName String The name of the record to check

Returns a HasResult that shows whether or not the record exists.

Show example...

listen(pattern,listener)opensource / enterprise

void listen(String pattern, ListenListener listenCallback)
argument type description
pattern String The pattern to match events which subscription status you want to be informed of
listener ListenListener The Listen Listener

Allows to listen for record subscriptions made by this or other clients. This is useful to create "active" data providers, e.g. providers that only provide data for a particular record if a user is actually interested in it.

You can only listen to a pattern once, and if multiple listeners match the same pattern only a single one will be notified.

Show example...

unlisten(pattern)opensource / enterprise

void unlisten(String pattern)
argument type description
pattern String The pattern that has been previously listened to

Remove the listener added via listen(pattern,listener). This will remove the provider as the active provider and allow another provider to take its place.

Show example...