/ SDKs / Unreal
SDKs
Chat SDKs Unreal v3
Chat SDKs Unreal
Chat SDKs
Unreal
Version 3

Add and remove a connection handler

Copy link

To detect changes in the connection status of a client app, you need to register a connection handler with its unique user-defined ID by calling the SBDMain::AddConnectionHandler().

class MyConnectionHandler : public SBDConnectionHandler {
    void Started() {
        // Network has been disconnected. Auto reconnecting starts.
    }

    void Succeeded() {
        // Auto reconnecting succeeded.
    }

    void Failed() {
        // Auto reconnecting failed. Call `connect` to reconnect to Sendbird.
    }
};

SBDMain::AddConnectionHandler(UNIQUE_HANDLER_ID, new MyConnectionHandler());

Where the activity isn't valid anymore, remove the connection handler.

// You can remove a specific connection handler. 
SBDMain::RemoveConnectionHandler(UNIQUE_HANDLER_ID);

// You can remove all registered connection handlers. 
SBDMain::RemoveAllConnectionHandlers();