Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Event handler

Add and remove a connection handler

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();