Before using the SDK, you will need to create a new SDK instance with your API key. Please find your account API key in the admin panel.

let client = EkoClient(apiKey: "YOUR_API_KEY")


In order to use any SDK feature, you must first register the current device with an userId. A registered device will be tied to the registered userId until the device is either proactively unregistered, or until the device has been inactive for over 90 days. A registered device will receive all the events messages belonging to the tied user.

An optional displayName can be provided, which will be used in standard push notifications (related to user's actions, such as when the new message is sent).

client.registerDevice(withUserId: "user1234", displayName: "John Appleseed")

The displayName is set only on the first time the device is registered, if you would like to update the displayName later, you can call EkoClient's setDisplayName:completion: method instead.

Recommended place to register device is in didFinishLaunchingWithOptions on AppDelegate (regarding documentation on or in the home view of your applications.


When the user logs out, you should explicitly unregister the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.



Each user can be registered, at the same time, to an unlimited number of devices. Eko will automatically synchronize the user data across all registered devices. Eko will also automatically unregister any device that has not been connected to the server for more than 90 days.

When a device is unregistered due to inactivity, the SDK data on the device will be reset. You will need to re-register this device in order to connect to server again.

Connection Status

If you have any logic or UI around the connection status, you can observe the connectionStatus property on the EkoClient instance.

Since the SDK automatically manages the network connection and queue up any requests in cases of bad connection, there should be little need to attach additional logic to this status. However the user may want to know the exact network status to determine if their actions will be performed in real-time, therefore this status exposed.

The connectionStatus flag supports KVO notifications, use NSObject's observe methods to be notified whenever this status changes.