Events Recovery
With the Pro Plan, you can send a recover
websocket event, which will send you back all the previously pushed events of the game.
This functionality is currently available on League of Legends and CS:GO.
When connected to the /matches/matchID/events
websocket channel, you can send a websocket message with the following parameters:
{"type":"recover","payload":{"game_id": GAME_ID}}
For example:
wscat -c 'wss://live.pandascore.co/matches/548763/events?token=YOUR_TOKEN'
{"type":"recover","payload":{"game_id":211051}}
var socket = new WebSocket('wss://live.pandascore.co/matches/548763/events?token=YOUR_TOKEN');
socket.onmessage = function(event) {
console.log(JSON.parse(event.data))
}
socket.onopen = function (_event) {
socket.send(JSON.stringify({"type":"recover","payload":{"game_id":211051}}));
};
RESPONSE
{"type":"hello","payload":{}}
{
"type":"recover",
"payload":{
"events":[
{
"game":{
"id":211051
},
"id":"3c8baf95-32c6-4e48-bcd1-8cb553e16447",
"ingame_timestamp":293,
"match":{
"id":548763
},
"payload":{
"killed":{
"object":{
"champion":{
"id":2542,
"name":"Cassiopeia"
},
"id":18,
"name":"Sneaky",
"role":"adc",
"team":"red"
},
"type":"player"
},
"killer":{
"object":{
"champion":{
"id":2519,
"name":"Rakan"
},
"id":605,
"name":"Mikyx",
"role":"sup",
"team":"blue"
},
"type":"player"
},
"type":"player"
},
"ts":1576510202000,
"type":"kill_feed"
},
{
"game":{
"id":211051
},
"id":"73b92fae-8e99-40fd-87b3-f224cb5dbd99",
"ingame_timestamp":293,
"match":{
"id":548763
},
"payload":{
"killed":{
"object":{
"champion":{
"id":2542,
"name":"Cassiopeia"
},
"id":18,
"name":"Sneaky",
"role":"adc",
"team":"red"
},
"type":"player"
},
"killer":{
"object":{
"champion":{
"id":2519,
"name":"Rakan"
},
"id":605,
"name":"Mikyx",
"role":"sup",
"team":"blue"
},
"type":"player"
},
"type":"player"
},
"ts":1579000089000,
"type":"kill_feed"
},
{
"game":{
"id":211051
},
"id":"909fd6b5-ace6-47cd-982e-5606d3aefcbf",
"ingame_timestamp":293,
"match":{
"id":548763
},
"payload":{
"killed":{
"object":{
"champion":{
"id":2542,
"name":"Cassiopeia"
},
"id":18,
"name":"Sneaky",
"role":"adc",
"team":"red"
},
"type":"player"
},
"killer":{
"object":{
"champion":{
"id":2519,
"name":"Rakan"
},
"id":605,
"name":"Mikyx",
"role":"sup",
"team":"blue"
},
"type":"player"
},
"type":"player"
},
"ts":1576579905000,
"type":"kill_feed"
},
{
"game":{
"id":211051
},
"id":"afdac8b8-1d1c-49f0-bff8-d1dc05e851aa",
"ingame_timestamp":293,
"match":{
"id":548763
},
"payload":{
"killed":{
"object":{
"champion":{
"id":2542,
"name":"Cassiopeia"
},
"id":18,
"name":"Sneaky",
"role":"adc",
"team":"red"
},
"type":"player"
},
"killer":{
"object":{
"champion":{
"id":2519,
"name":"Rakan"
},
"id":605,
"name":"Mikyx",
"role":"sup",
"team":"blue"
},
"type":"player"
},
"type":"player"
},
"ts":1578930517000,
"type":"kill_feed"
}
]
}
}