Part of the Library Booking System.
WebSocket gateway service for real-time updates in the library booking system.
The Realtime Gateway provides WebSocket connections for real-time updates about:
- Resource availability changes
- Booking status updates
- System notifications
- WebSocket server on port 3008
- RabbitMQ integration for event consumption
- Broadcasts real-time updates to connected clients
- Automatic reconnection to RabbitMQ on failure
PORT: WebSocket server port (default: 3008)RABBITMQ_HOST: RabbitMQ host (default: rabbitmq)RABBITMQ_PORT: RabbitMQ port (default: 5672)RABBITMQ_USER: RabbitMQ username (default: admin)RABBITMQ_PASS: RabbitMQ password (default: admin)
The service is automatically built and started with docker-compose:
cd docker-compose
docker-compose up -d realtime-gatewayOr build it separately:
cd realtime-gateway
docker build -t library-realtime-gateway .
docker run -p 3008:3008 library-realtime-gatewaySubscribe to updates:
{
"type": "subscribe",
"topic": "resource_123"
}Availability update:
{
"type": "availability_update",
"resourceId": 123,
"status": "available"
}Connection confirmation:
{
"type": "connected",
"message": "Connected to realtime gateway"
}The gateway is accessible via the API Gateway at:
ws://localhost:8080/ws/(when proxied through API Gateway)ws://localhost:3008(direct connection)