Skip to main content

AutoReconnect

AutoReconnect

Component that automatically reconnects to the last room after being forcefully disconnected due to a networking error.

Events

willConnect

event Action<AutoReconnect, WillConnectArgs> willConnect

Event triggered before attempting to reconnect to the room.

willConnectAsync

event Func<AutoReconnect, WillConnectArgs, Task> willConnectAsync

Event triggered before attempting to reconnect to the room.

This event is asynchronous and is awaited. It allows for custom logic to be executed before the reconnection attempt, such as updating a room name to connect to a different lobby.

didConnect

event Action<AutoReconnect> didConnect

Event triggered after a successful connection to the room.

didDisconnect

event Action<AutoReconnect, DidDisconnectArgs> didDisconnect

Event triggered after being disconnected from the room.

didCancel

event Action<AutoReconnect> didCancel

Event triggered when the user cancels the reconnect attempt.

reconnectTimerDidUpdate

event Action<AutoReconnect, int> reconnectTimerDidUpdate

Event triggered when the reconnect timer updates, providing the remaining time before the next connection attempt in seconds.

Properties

realtime

Realtime realtime { get; }

The Realtime component used for connecting to the room.

isReconnecting

bool isReconnecting { get; }

Whether an auto-reconnect is currently in progress.

waitTime

float waitTime { get; }

The time in seconds before the next connection attempt.

remainingTime

float remainingTime { get; }

The time remaining in seconds before the next connection attempt.

retryCount

int retryCount { get; }

The number of reconnect attempts made since the last successful connection.

maxRetries

int maxRetries { get; }

The maximum number of reconnect attempts before giving up.

roomName

string roomName { get; set; }

The room name used to connect.

quickmatchRoomGroupName

string quickmatchRoomGroupName { get; set; }

The room group name used when connecting with Quickmatch.

quickmatchRoomCapacity

int? quickmatchRoomCapacity { get; set; }

The room capacity used when connecting with Quickmatch.

connectOptions

ConnectOptions connectOptions { get; set; }

The connection options used to connect.

reconnectMode

ReconnectMode reconnectMode { get; set; }

How the next reconnect attempt will try to join a room.

Methods

Reconnect

void Reconnect()

Reconnect using the last known room name and connection options.

CancelReconnect

void CancelReconnect()

Cancel any pending reconnect attempts.