This documentation provides details for frontend developers integrating with the Rain system socket events.
Overview
The Rain system is a community reward mechanism where a "pot" of sweepstake balance accumulates over time (via tips and automated intervals) and is distributed to active users. The rain lifecycle consists of several phases: Idle, Raining (join phase), and Distributing.
Configuration Constants
Rain Interval: 2 hours (Time between rain sessions).
Join Duration: 60 seconds (Window for users to join once rain starts).
Min Tip: 1 coin.
Wager Requirement: Users must meet a 7-day wager requirement to be eligible for rewards (currently set to 0 for testing).
Client -> Server Events
get-rain-status
Request the current status of the rain system.
Payload: None
Response: Emits rain-status.
join-rain
Join the current active rain session.
Payload: None
Response: Emits rain-response.
Note: Only possible when status is raining.
tip-rain
Add coins to the rain pot.
Payload: { amount: number }
Response: Emits rain-response.
Note: Deducts balance immediately.
Server -> Client Events
rain-status
Broadcasted status updates.
Data:
rain-started
Sent when a new rain session enters the join phase.
Data: { pot: number, duration: number, endsAt: Date }