feat: implement Socket.IO server with queue management and update environment variables

This commit is contained in:
2025-09-19 18:58:22 +02:00
parent 741afb6e81
commit cb326f7190
5 changed files with 265 additions and 89 deletions

View File

@@ -47,7 +47,7 @@ This repository contains a minimal demo of a queue system for high-concurrency t
Files added in this demo:
- `pages/api/socket.js` — Next.js API route with Socket.IO server, in-memory queue logic and JWT issuance (demo only).
- `app/api/socketio/route.js` — Next.js App Router API route that initializes the Socket.IO server, in-memory queue logic and JWT issuance (demo only).
- `.env.example` — example environment variables for the queue system.
- `app/page.tsx` — client UI (Next.js) that connects via Socket.IO and displays queue position, estimated wait, and purchase button.
@@ -65,13 +65,13 @@ Running locally
pnpm install
```
3. Start the Next.js dev server (includes the Socket.IO API route):
3. Start the Next.js dev server:
```powershell
pnpm dev
```
4. Open `http://localhost:3000` and the client will connect to the Socket.IO API route at `/api/socket`.
4. Open `http://localhost:3000` - the page will automatically initialize the Socket.IO server via API call to `/api/socketio`, then connect to it on port 4000.
Next steps / improvements