Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Pewiz/ulagos360/llms.txt

Use this file to discover all available pages before exploring further.

The header of ULagos 360° displays a real-time connection indicator at all times. A green Wifi icon means the Socket.IO connection to the backend is active and space updates are broadcast instantly to every tutor on the network. A red WifiOff icon means the connection has been lost — no live updates will arrive, but the app continues to function and stores every change locally until the connection is restored.

Connection States

Connected

When the Socket.IO handshake with https://ulagos360-backend-production.up.railway.app succeeds, the header shows:
  • A green Wifi icon
  • The label “Conectado” (visible on sm screens and above)
In this state every space-status change is emitted to the server in real time and all other connected tutors receive the update immediately.

Disconnected

When the socket drops or cannot reach the server, the header switches to:
  • A red WifiOff icon
  • The label “Desconectado” (visible on sm screens and above)
Space changes you make while offline are persisted to localStorage via the Zustand spaces-storage key and the persistent backup hooks, so nothing is lost.

Auto-Reconnect Behaviour

The socket client is configured with the following reconnection parameters inside useSocketConnection.js:
// src/hooks/useSocketConnection.js
socketRef.current = io(
  "https://ulagos360-backend-production.up.railway.app",
  {
    transports: ["polling", "websocket"],
    upgrade: true,
    timeout: 30000,
    reconnection: true,
    reconnectionDelay: 2000,
    reconnectionAttempts: 5,
    maxReconnectionAttempts: 5,
    reconnectionDelayMax: 10000,
    randomizationFactor: 0.5,
    forceNew: false,
    autoConnect: true,
    withCredentials: false,
    rememberUpgrade: false,
  }
);
ParameterValueEffect
reconnectiontrueAutomatic reconnect is enabled
reconnectionDelay2 000 msWait 2 s before the first retry
reconnectionAttempts5Maximum number of retries
maxReconnectionAttempts5Hard cap on reconnection attempts
reconnectionDelayMax10 000 msCap each retry delay at 10 s
randomizationFactor0.5±50 % jitter added to each delay
timeout30 000 msConnection attempt timeout
forceNewfalseReuse existing socket if available
autoConnecttrueConnect immediately on creation
withCredentialsfalseNo cookies or auth headers sent
rememberUpgradefalseAlways re-negotiate transport on reconnect
The effective delay for each attempt grows exponentially with jitter: delay = min(reconnectionDelay × 2ⁿ, reconnectionDelayMax) × (1 ± randomizationFactor)

Transport Strategy

The client starts with polling as the initial transport and automatically upgrades to websocket once the server signals it is available (upgrade: true). This ensures the connection is established even in restrictive network environments (such as university Wi-Fi) that may block raw WebSocket traffic on the first attempt.

On Reconnect: State Recovery

When the socket reconnects, useSocketConnection.js immediately re-registers the current user and requests the full server state:
// Emitted on every successful (re)connect
socket.emit("register_user", {
  ...user,
  sessionId,
  persistentSession: true,
  timestamp: Date.now(),
  userId: user.id,
  userName: user.name,
});

socket.emit("get_all_spaces", {
  userId: user.id,
  sessionId,
  timestamp: Date.now(),
  immediate: true,
});
The get_all_spaces event triggers the server to respond with the latest space state, overwriting any stale local entries and bringing the tutor fully up to date.
If all 5 reconnection attempts fail the socket enters a permanently disconnected state for that session. The app remains fully usable offline — all changes continue to be saved to localStorage — but they will not sync to other tutors until you manually reload the page to re-establish the connection.
You can continue marking spaces as occupied, reserved, or available while disconnected. Every change is persisted locally and will sync automatically to the server the moment connectivity is restored.

Build docs developers (and LLMs) love