Alive messages are like a heartbeat. These messages indicate that the given producer is operating normally and you are able to receive messages from it. You can also see from the message if you are subscribed to that producer or not.
Alive messages are sent by each producer every 10 seconds.
If you stop receiving alive messages at the expected intervals, it is indicating something might be wrong with the connection between our service and yours.
<alive timestamp="1234579" product="2" subscribed="1"/>| Name | Description |
|---|---|
| timestamp | Timestamp in milliseconds since epoch when this message was generated according to generating system's clock. |
| product | The producer that sent this alive message. |
| subscribed | If set to 0, this means the producer is up again after downtime (but you are not receiving anything else other than alive messages), you should issue recovery messages against the API to resubscribe to the producer and start receiving any additional messages. If set to 1, that not only the producer is up but that you should be receiving other messages as well. Please note that after you'll recieve subscribed set to 0 untill the first recovery request is sent and when recovery is completed, you'll start recieving the alive messages with attribute subscribed = 1 |
The alive message is automatically handled by the SDK, so it’s not exposed to the client, and what it does is tracking of alive messages. By default, if there’s no alive message for 20 seconds, it will trigger a producer down message, which means that you should take immediate action on your side and suspend all the betting markets for the producer that is down.
Producers are decoupled, meaning one producer's downtime won't affect others. All betting markets for the specific producer that is down should be suspended, while the rest of the producers and their associated markets remain unaffected as long as they are active.
Once the connection is established again, recovery should be requested from the last stored timestamp from the affected producer, the requests should be done per connection/Node ID & Producer ID individually". Once the recovery is completed, snapshot_complete message will be sent, which indicates that all of the messages from the recovery were sent, and if you process them all, you should be able to go back into betting again (re-open only active markets per producer).
What is important to look at is the timestamp inside the alive messages, and the time interval you are receiving them.
Trigger recovery on given producer through UOF API if
Special cases
Both these situations are denoted as not receiving an alive message in the below.
The recommended action is described below, and you can only treat the connection as up again only after recovery has been completed (confirmed with a snapshot_complete message)
Recovery Handling (or Post Recovery Instructions)
If you have not received an alive message, and successfully completed a recovery from a given producer for a certain amount of time, you should act according to the match state. Here are some recommendations, but you are free to use other thresholds for the actions:
If the match is pre-match, and kicking off in more than 5 minutes, and you have not received an alive message in 5 minutes, then we recommend to suspend all markets on that match. However, to avoid losing business, it might be good to keep accepting bets in a restricted way (e.g. increased odds key, reduced limits, limited market offers, etc.).
You can only treat the connection as up again once recovery has been completed and confirmed with a snapshot_complete message. You should only reopen markets and bets (applicable to all producers) after you have successfully completed a recovery.
Please contact Betradar support
EMAIL: Support@sportradar.com
PHONE: +41 71 517 72 00
If you have any questions about recovery not covered in the documentation.
Example instance of interruption and recovery handling
Example showing how to act for an in play event
Example showing how to act for a pre-match event
Here are some producers that are available for the product attribute found in the above table:
<producers response_code="OK">
<producer id="1" name="LO" description="Live Odds" />
<producer id="3" name="Ctrl" description="Betradar Ctrl" />
<producer id="4" name="BetPal" description="BetPal" />
If you do not receive an alive message for more than 15 seconds, you must wait until you start receiving alive messages again and then issue a recovery from UOF API from the time you last received a message. Be aware that if you start issuing recovery requests before you start receiving alive messages, the requests will not be successful, and you might hit our rate limiting on the recovery endpoint.
| Time (minutes:seconds) | 0:10 | 0:24 | 0:30 | 0:40 | 0:45 | 0:50 | 0:56 | 0:60 | 0:70 |
|---|---|---|---|---|---|---|---|---|---|
| Alive message from live producer | OK | OK | OK | OK | OK | OK | |||
| In play event status | Active | Active | Active | Active | Suspended | Suspended | Suspended | Active | Active |
| Connection handling | - | - | - | - | - | - | Issue recovery | Snapshot complete | - |
| Time (minutes:seconds) | 1:00 | 1:10 | 1:20… | 2:00 | 2:10… | 7:00 | 10:00… | 11:00… | 12:00… |
|---|---|---|---|---|---|---|---|---|---|
| Alive message from pre match producer | OK | OK | OK | OK | OK | ||||
| Pre-match event status | Active | Active | Active | Active | Active | Suspended | Suspended | Active | Active |
| Connection handling | - | - | - | - | - | - | Issue recovery | Snapshot complete | - |