why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

The main entry point for a DeepstreamClient. Clients can be created directly using the constructor or via DeepstreamFactory.getClient(), DeepstreamFactory.getClient(url) or DeepstreamFactory.getClient(url, options) to create a client and keep it as a singleton for future references.

Fields

record

Allows access to concepts related to deepstreamHub's realtime datastore, such as:

event

The entry point for events, such as:

rpc

The entry point for RPCs, deepstreamHub's request-response mechanism:

Constructors

DeepstreamClient(url)

DeepstreamClient(String url) throws URISyntaxException
argument type description
url String The url to connect to

Creates a client instance using the default properties and initialises the connection to deepstreamHub. The connection will be kept in a quarantine state and won't be fully usable until DeepstreamClient.login() is called.

Show example...

DeepstreamClient(url,options)

DeepstreamClient(String url, Properties options) throws URISyntaxException,   
argument type description
url String The url to connect to
properties Properties The properties to configure the client with

Creates a client instance, merging the default options with the passed in configuration and initialises the connection to deepstreamHub. The connection will be kept in a quarantine state and won't be fully usable until DeepstreamClient.login() is called.

Show example...

Methods

setRuntimeErrorHandler(handler)

void setRuntimeErrorHandler(DeepstreamRuntimeErrorHandler handler)
argument type description
handler DeepstreamRuntimeErrorHandler The listener to set

Adds a DeepstreamRuntimeErrorHandler that will catch all RuntimeErrors such as AckTimeouts and allow the user to gracefully handle them.

Show example...

login()

LoginResult login()
Authenticates the client against the platform with an empty authentication object and returns a LoginResult. To learn more about how authentication works, please have a look at the Security Overview. Show example...

login(authParams)

LoginResult login(JsonElement authParams)
argument type description
authParams JsonElement JSON.serializable authentication data

Authenticates the client against the platform with the given credentials and returns a LoginResult. To learn more about how authentication works, please have a look at the Security Overview.

Show example...

close()

DeepstreamClient close()
Ends the connection to the platform. Show example...

addConnectionChangeListener(listener)

DeepstreamClient addConnectionChangeListener (ConnectionStateListener listener)
argument type description
connectionStateListener ConnectionStateListener The listener to add

Add a listener that can be notified via ConnectionStateListener.connectionStateChanged(state) whenever the ConnectionState changes. A list of possible connection states is available here

Show example...

removeConnectionChangeListener(listener)

DeepstreamClient removeConnectionChangeListener(ConnectionStateListener listener
argument type description
connectionStateListener ConnectionStateListener The listener to remove

Removes a ConnectionStateListener added via DeepstreamClient.addConnectionChangeListener()

Show example...

getUid()

String getUid()

Returns a random id. The first block of characters is a timestamp, in order to allow databases to optimize for semi- sequentuel numberings.

Show example...