WebSocket Events
Detailed documentation on WebSocket events for the ProphetX Service API, including data structures and channel information.
ProphetX Service API — WebSocket Events
Various common use cases of WebSocket events can be found here: ProphetX Service API WebSocket Use Cases.
WebSocket Event Messages’ Data Structure
{
"timestamp": int64,
"change_type": string,
"payload": base64 encoded string,
"op": string
}The payload part would be different for different change_type, and it is detailed below.
The available op values are:
cstands for createustands for updatedstands for delete
There are two channels, one is “Broadcast channel” and another one is “Private channel”. Keep reading to know more details about each of them.
Broadcast Channel
Messages pushed through this channel are also pushed to all other API users who are actively listening to the channel.
As of June 10th, 2024, there are 6 types of events pushed through this broadcast channel:
-
tournament
Message pushed when a new tournament is available, an existing tournament is disabled, or tournament data is updated.
Payload structure:{ "id": string, // unique identifier of tournament "info": { "banner": string, "category": { "countryCode": string, "id": integer, "name": string }, "id": integer, // id of tournament "image": string, "name": string, "sport": { "id": integer, "name": string }, "sequence_number": int } } -
market
Message pushed when a new market is available for an event, removed from an event, or market data is updated for an event.
Payload structure:{ "id": string, // unique identifier of sport_event "info": { "id": int, // id of market "sport_event_id": int, // id of sport_event same as outer id "name": string, "status": string, "description": string, "sequence_number": int } } -
sport_event
Message pushed when a new event is available in a tournament, existing events are removed from the site, or event data is updated.
Payload structure:{ "id": string, // unique identifier of sport_event "tournament_id": string, "info": { "competitors": [ { "abbreviation": string, "country": string, "display_name": string, "id": integer, // id of competitor "name": string, "side": string } ], "display_name": string, "event_id": integer, "name": string, "scheduled": string, "sport_name": string, "status": string, "tournament_name": string, "type": string, "sequence_number": int } } -
market_line
Line for markets: messages pushed when we have a new line, remove an existing line, or update line data.
Payload structure:{ "id": int, // market_line id "info": { "id": int, "sport_event_id": int, "market_id": int, "outcome_id": int, "line": float, "line_id": string, "type": string, "name": string, "status": string, "favourite": bool, "sequence_number": int } } -
market_selections
Message for all selections in a market line pushed when the liquidity of a selection changes (new plays, matched plays, play voided, play cancelled). It is calculated based on play unmatched stake on a market line.
Payload structure:{ "sport_event_id": int, "market_id": int, "info": { "id": int, "name": string, // Market name "selections": [ // Contains two arrays of best selections // Current system limits each array to 10 best selections for this event // If no best selection, the system will return one fake selection [ { "outcome_id": int, "name": string, "competitor_id": int, "line": float, "line_id": string, "odds": float, "display_odds": string, "display_line": string, "display_name": string, "value": float, "stake": float, "updated_at": int } ], [ { "outcome_id": int, "name": string, "competitor_id": int, "line": float, "line_id": string, "odds": float, "display_odds": string, "display_line": string, "display_name": string, "value": float, "stake": float, "updated_at": int } ] ], "type": string, "line": float, "sequence_number": int } } -
matched_bet
Once a successful match happens, a message will be broadcast to everyone about the matching odds for the match just happened.
Payload example:{ "info": { "line": 0, "line_id": "cffa7ddc4fd50acbe51684e7addabe00", "market_id": 219, "matched_odds": 124, "matched_stake": 45.3, "odds": 124, "origin_market_line": 0, "outcome_id": 4, "sequence_number": 1709130007835319000, "sport_event_id": 44285780 } }
Private Channel
Messages pushed through this channel are only available to you.
As of June 10th, 2024, there are 2 event types pushed through this broadcast channel:
-
wager
Updates on your play status. When your play is activated or cancelled, a message will be sent. When your play gets matched, another message will be sent including updated metadata of the play.
Payload structure:{ "info": { "id": string, "user_id": string, "market_id": int, "sport_event_id": int, "outcome_id": int, "odds": float, "line": float, "stake": float, "profit": float, "matched_stake": float, "matched_odds": float, "totally_matched_stake": float, "unmatched_stake": float, "matching_status": string, "winning_status": string, "status": string, "external_id": string, "line_id": string, "update_type": string, "sequence_number": int } } -
health_check
Every 5 seconds, a health check message will be sent to all WebSocket sessions.
Payload example:{ "event": "health_check", "data": { "change_type": "private_system_signal", "op": "u", "payload": "e30=", "timestamp": 1717689526365275600 } }
Updated 9 days ago