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 initilizer or via DeepstreamFactory.getClient(), DeepstreamFactory.getClient(_:) or DeepstreamFactory.getClient(_: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:

Initializers

init(_:)

init(_ url: String) throws
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...

init(_:properties:)

init(_ url: String, properties: JsonElement) throws
argument type description
url String The url to connect to
properties JsonElement 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(_:)

class func setRuntimeErrorHandler(_ handler: DeepstreamRuntimeErrorHandler) -> Void
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()

class func login() -> LoginResult

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(_:)

class func login(_ authParams: JsonElement) -> LoginResult
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()

class func close() -> Self

Ends the connection to the platform.

Show example...

addConnectionChangeListener(_:)

class func addConnectionChangeListener (_ listener: ConnectionStateListener) -> Self
argument type description
connectionStateListener ConnectionStateListener The listener to add

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

Show example...

removeConnectionChangeListener(_:)

class func removeConnectionChangeListener(_ listener: ConnectionStateListener) -> Self
argument type description
connectionStateListener ConnectionStateListener The listener to remove

Removes a ConnectionStateListener added via DeepstreamClient.addConnectionChangeListener(_:)

Show example...

getUid()

class func getUid() -> String

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