Server sent events - Saba-sports/OddsDirectAPI GitHub Wiki
Means this user connected success, and will send KEEPALIVE every five seconds, which means it is still connected.
| status | message | Description |
|---|---|---|
| 0 | Success | Connect success and continue to get the updated data. |
| 1 | InitialData | First time to connect and get initial data. |
| 3 | Reset | Reset connection. |
| 97 | Invalid Accept-Encoding | Http Status Code = 400 The encoding compression format is invalid. |
| 98 | Invalid OData query attributes | Http Status Code = 400 The Odata query attributes are invalid or not support. |
| 99 | System under maintenance | Http Status Code = 503 System is under maintenance. |
| 100 | Internal Server Error | Http Status Code = 500 The server encountered an unexpected condition that prevented it from fulfilling the request. |
- It will return status
1when the first time to connect, and the initial data will be in the add class. When the message of status1is obtained, the front-end display should be re-rendered using theadddata of the message; the updated data with status=0 will continue to be received in add/change/remove classes.
- If the user disconnects due to the network or other issue:
- If using browser native javascript EventSource api, without closing the page, the browser will auto-reconnect and add Last-Event-Id in the header. Server will base on the Last-Event-Id and resend the missing data to client.
- If using other languages or frameworks, need to create the reconnection mechanism and add Last-Event-Id into the header by themselves.
- If cannot find the Last-Event-Id, it will reset the connection by status
3, and the data is initial data, the front-end display should be re-rendered using theadddata of the message.