Automatic Reconnects

If the user loses connection to the Audio Service you can expect an onConnectionChange event with a status of AloAudio.CONNECTION_STATUS_ERROR. After that the SDK will automatically handle trying to reconnect. The first few attempts to reconnect will occur right away. If it fails to reconnect it will continually increase the amount of time between reconnect attempts.

As the SDK is in reconnect mode it will fire onConnectionChange events with the status of AloAudio.CONNECTION_STATUS_RECONNECT_PENDING. Within the payload of that event you will see information about the number of times it tried to reconnect and the amount of time before it will try again. This event will be dispatched every second until the connection has been reestablished. You can use this information to info your user about how long it will be before the next reconnect attempt.

If you would like the library to stop trying to connect you can call the disconnect() method.

Example Reconnect Pending Event Payload

{
    detail : {
        state: "RECONNECT_PENDING",
        user: AudioUser {...},            
        message: "Audio Server Reconnect Pending",
        pendingRestartSeconds": 10,
        retryCount: 2,
        stateMessage: "Audio Server Reconnect Pending"
    }
}

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved