This repository contains two small apps (server + client) that demonstrate a realtime appointment-status flow using Socket.IO. It is intentionally minimal so you can drop the same patterns into larger frontend and backend projects.
Quick start (from workspace root):
- Install server deps
cd server npm install
- Install client deps
cd ../client npm install
- Start server
cd ../server npm start
- Start client
cd ../client npm run dev
Open http://localhost:5173 in your browser to view the demo.
- A canonical Socket.IO server that validates and persists appointment status changes.
- A Vite + React client that connects, joins rooms (clinic/appointment/role) and receives authoritative updates.
- An event contract (small, stable API) that makes it simple to integrate into larger apps.
- Backend: implement
appointment:updateStatusserver handler that validates, persists, and broadcastsappointment:statusto rooms likeclinic:<id>andappointment:<id>. - Frontend: add a small socket wrapper + React Context, join relevant rooms, and update UI from
appointment:statusevents. Use socket acks for write confirmations.
For full integration details, event contracts, code snippets and scaling/security notes see docs/EXPLAIN.md or the online copy: WEBSOCKET docs on Notion
If you want, I can add the concrete client/src/lib/socket.js and client/src/contexts/SocketContext.jsx files to this repo next.