Class DeepstreamFactory

A singleton that allows for centralized access to a created DeepstreamClient. Alternatively, clients can be initialised directly.

Currently this only contains a single deepstream client.

Methods

DeepstreamFactory getInstance()

DeepstreamFactory factory = DeepstreamFactory.getInstance();

DeepstreamClient getClient()

Returns the last client that was created. This is useful for most applications that only require a single connection. The first time a client is connected however it has to be via getClient(url) or getClient(url,options).

DeepstreamFactory factory = DeepstreamFactory.getInstance();
DeepstreamClient client = factory.getClient();

DeepstreamClient getClient(String url) throws URISyntaxException

Argument Type Description
url String The server URL

Returns a client that was previous created via the same url using this method or getClient(url,options).

If a client hasn’t been created yet, it creates it first and stores it for future reference.

DeepstreamFactory factory = DeepstreamFactory.getInstance();
DeepstreamClient client = factory.getClient("ws://localhost:6020");

DeepstreamClient getClient(String url, Properties options) throws URISyntaxException, InvalidDeepstreamConfig

Argument Type Description
url String The server URL
options Properties The options to use within the deepstream client

Returns a client that was previous created via the same url using this method or getClient(url,options).

If a client hasn’t been created yet, it creates it first and stores it for future reference.