Overview
The SolBid WebSocket server broadcasts real-time events to all connected clients. Events are sent as JSON messages and include game creation and bid updates.Event format
All server events follow this structure:The event type identifier
Event payload containing game or bid information
Event types
new-game
Broadcast when a new game is created and added to the game manager.Data fields
Unique game identifier
Human-readable game ID string
Starting bid amount for the game
Current highest bid amount
ISO 8601 timestamp of the most recent bid
Total number of bids placed in this game
Current prize pool amount
Whether the game has ended
ISO 8601 timestamp when the game was created
Player information (currently single player object)
Player ID
Cumulative total of all bids by this player
Total number of bids placed by this player
The
new-game event is triggered in gameManager.ts:35 when a game is successfully added to the game manager.game-update
Broadcast when an existing game is updated with a new bid.Data fields
Thegame-update event uses the same data structure as new-game. All fields are identical.
The
game-update event is triggered in gameManager.ts:46 when a bid is placed on an existing game.Client messages
Clients can send messages to trigger game actions. All messages require authentication.create-game
Create a new game.Must be
"create-game"Valid JWT token for authentication
Creating a game will trigger a
new-game event broadcast to all connected clients.place-bid
Place a bid on an existing game.Must be
"place-bid"Valid JWT token for authentication
Game ID to place the bid on
Placing a bid will trigger a
game-update event broadcast to all connected clients.Broadcast behavior
All events are broadcast to every connected client simultaneously:- Events are only sent to clients with
readyState === WebSocket.OPEN - Messages are serialized to JSON before sending
- No acknowledgment or delivery confirmation is provided
The broadcast mechanism is implemented in
gameManager.ts:82-89 and ensures all active clients receive updates in real-time.