Add or remove a connection delegate
To detect changes in the connection status of a client app, register a connection delegate ConnectionDelegate
with its unique user-defined ID.
If you want to stay informed of changes related to the Sendbird server connection status and notify the changes to different client apps, define and register multiple connection delegates to each view controller.
Connection event types
List of connection events
Method | Invoked when | Notified devices |
---|---|---|
didConnect(userId:) | The SDK has connected with the given | The device that was connected to the server. |
didDisconnect(userId:) | The SDK has disconnected for the | The device that was disconnected from the server. |
didStartReconnection | The SDK has started reconnecting to the Sendbird server. | The device where |
didSucceedReconnection | The SDK has succeeded in reconnecting to the Sendbird server. | The device that successfully reconnected to the server. |
didFailReconnection | The SDK has failed to reconnect to the Sendbird server. | The device that failed to reconnect to the server. |
Add a connection delegate
The following code shows a full set of supported event callbacks and how to add a connection delegate to the unique SendbirdChat
instance.
Remove a connection delegate
The following code shows how to remove the connection delegate.