Backend Documentation

Realtime Socket

Socket.IO runtime structure and chat event handling across user and agent channels.

Initialization

Socket server is initialized in `socket/index.js` via `initializeSocketIO(server)` from `app.js`.

Handlers

Handler modules include bot, conversation, message, order, typing, user, and disconnect handlers under `socket/handlers`.

State Management

Connection-level state and tracking are centralized through `socket/state.js` and related utility methods.

Client Access

Socket client assets are exposed through `/socket.io` static mount from `node_modules/socket.io/client-dist`.