Receive Jackpot Events
Push Event Service Integration
To deliver real-time jackpot updates and winner notifications, your application can subscribe to our Push Event Service using Server-Sent Events (SSE). This allows you to react instantly to jackpot changes or player-specific results without repeatedly polling the backend.
Overview
Using SSE, your client-side application can subscribe to two distinct channels:
- Broadcast Channel: For general jackpot updates and winner events.
- Player Channel: For player-specific notifications, such as individual jackpot wins.
This setup is ideal for keeping the jackpot display live and responsive.
Sequence Overview
The interaction works as follows:
1. Subscription Setup
- Your front end establishes two SSE connections:
- One to the Broadcast Channel
- One to the Player Channel (identified via
PlayerSecureId)
2. Real-Time Updates from the Server
- Broadcast Channel periodically receives:
- Jackpot value updates
- Events announcing winners
(Note: not every game spin triggers an update—only periodic broadcasts are sent)
- Player Channel sends:
- Direct win notifications if the subscribed player hits a jackpot
3. Message Handling
- Your client handles these event messages to update the UI, display toast notifications, trigger animations, etc.
Implementation Details:
Here’s a basic SSE example in JavaScript for each channel:
// Broadcast Channel
const broadcastSource = new EventSource('
https://push-events.flows.world/subscribe?channel=<WorkspaceId>_broadcast_<JackpotGroupId>);
broadcastSource.onmessage = (event) => {
const data = JSON.parse(event.data);
// Update jackpot display or show winner info
};
// Player Channel (requires secure ID)
const playerSecureId = 'PLAYER_12345';
const playerSource = new EventSource(`https://push-events.flows.world/subscribe?channel=<WorkspaceId>_user_<PlayerId>`);
playerSource.onmessage = (event) => {
const data = JSON.parse(event.data);
// Show win message or animation
};Event Types
Below is a breakdown of the supported events for each channel.
Broadcast Channel Events
These are sent to all subscribed clients and are typically used to update jackpot display widgets.
Sample Message:
{
"reason": "jackpot_value",
"jackpotInstance": "3XiLXZkU_5",
"jackpot": "3XiLXZkU",
"channel": "8mQhEnuznUe01IsGOE4mPw_broadcast_fce39b15-9fc1-42bb-8d96-e65c1d17feac",
"currency": "EUR",
"value": "372.2"
} Fields:
reason: "jackpot_value" — indicates the jackpot value has been updated.
jackpotInstance: The current jackpot round ID.
jackpot: The base jackpot identifier.
channel: The SSE channel used for the broadcast.
currency: Currency for the value.
value: Updated jackpot amount as a string.
Use case: Update your public-facing jackpot display.
Jackpot Won by Another Player
This event notifies all users that someone else has won the jackpot. It can be used to trigger global animations or updates to reflect the reset jackpot.
Sample Message:
{
"reason": "jackpot_won_other",
"jackpotInstance": "f8f21i6__12",
"jackpot": "f8f21i6_",
"channel": "8mQhEnuznUe01IsGOE4mPw_broadcast_fce39b15-9fc1-42bb-8d96-e65c1d17feac",
"currency": "EUR",
"value": "360.00",
"jackpotNewInstance": "f8f21i6__13"
} Fields:
reason: "jackpot_won_other" — indicates another player has won the jackpot.
jackpotInstance: The instance that was just won.
jackpot: The base jackpot identifier.
channel: The broadcast SSE channel.
currency: Currency of the win.
value: The jackpot amount that was won.
jackpotNewInstance: The new jackpot instance created after the win.
Use case: Visually reset the jackpot display and optionally show a "Jackpot Won!" announcement to all users.
Player (User) Channel Events
These are private messages sent only to the relevant player—typically when they win a jackpot.
Sample Message:
{
"reason": "jackpot_won",
"jackpotInstance": "6sca3_LR_7",
"jackpot": "6sca3_LR",
"channel": "8mQhEnuznUe01IsGOE4mPw_user_a@b.com",
"currency": "EUR",
"value": "1,408.20",
"jackpotNewInstance": "6sca3_LR_8"
} Fields:
reason: "jackpot_won" — indicates the player has won a jackpot.
jackpotInstance: The instance the user won.
jackpot: The base jackpot identifier.
channel: The SSE channel specific to this user.
currency: Currency of the win amount.
value: The jackpot value won.
jackpotNewInstance: The new jackpot round created immediately after the win.
Use case: Display win notifications, trigger animations or celebratory UI for the player.
Best Practices
- Connection management: Handle disconnections and attempt reconnections as needed (SSE reconnects automatically by default).
- Event filtering: Consider filtering incoming messages based on event type if your client handles multiple jackpot games.
This SSE-based system ensures your front end stays in sync with live jackpot events without heavy backend polling. In the next section, we’ll cover Event Message Formats and how to interpret them effectively.