@whogoes/server
v1.0.0
Published
Self-hostable real-time presence server — Fastify + WebSocket + Redis
Maintainers
Readme
@whogoes/server
The backend service for Whogoes, built with Fastify, WebSocket, and Redis.
Architecture
- Fastify: Web framework and WebSocket support.
- ioredis: Redis client for Pub/Sub and state management.
- WebSocket: Real-time communication with clients.
Configuration
Environment variables can be set in a .env file or the system environment.
| Variable | Description | Default |
|Link |---|---| (sic)
| PORT | The port the server listens on | 3000 |
| REDIS_URL | Connection string for Redis | (local default) |
| USE_MOCK_REDIS | Set to true to use in-memory Redis | false |
Running
Development
Run the server with hot-reloading.
npm run devMock Mode
Run without a real Redis instance (useful for local development).
npm run dev:mockProduction
Build and start the server.
npm run build
npm run startAPI
WebSocket /ws
The primary endpoint for client connections. Clients should upgrade to this endpoint to establish a WebSocket connection.
Query Parameters:
token: Authentication token (currently mocked/placeholder).roomId: The ID of the room to join.
Messages
The server handles the following message types:
ping/pong: Heartbeat.presence.update: Updates a user's state.presence.snapshot: Sent to client on join with full room state.presence.join: Broadcast when a user joins.presence.leave: Broadcast when a user leaves.
