void Register (string clientId, Response.Room room) {
// Add room data to ConnectionInfo
connection.clientId = clientId;
connection.room = room;
// Listen for dropped clients
Co.InvokeWhileTrue (0.5f, () => { return Application.isPlaying && connection.connected; }, () => {
Emit<Response.DroppedClients> ("checkDropped", connection.roomId, (Response.DroppedClients res) => {
// Ignore if this client has been dropped
if (dropped)
return;
// Send a message if a client was dropped or if previously dropped clients have reconnected
if (res.dropped && !hasDroppedClients) {
if (onUpdateDroppedClients != null)
onUpdateDroppedClients (true);
hasDroppedClients = true;
} else if (!res.dropped && hasDroppedClients) {
if (onUpdateDroppedClients != null)
onUpdateDroppedClients (false);
hasDroppedClients = false;
}
});
});
}