Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

WoT mod for making battle results available to the browser

License

Notifications You must be signed in to change notification settings

lgfrbcsgo/wot-battle-results-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WoT Battle Results Server

WoT mod which starts a WebSocket server on ws://localhost:15455 for serving battle results.

The server has a peer dependency on WoT Websocket Server, WoT Async Server, WoT Async, and WoT Hooking.

Demo Apps

Live WN8 (Source)

Live Win Rate (Source)

Origin Whitelisting

Origins need to be whitelisted to protect against malicious websites. All localhost origins are white listed for local testing.

Please open an issue if you want to deploy your app and need your origin to be included in the whitelist.

Protocol

The server uses a protocol which is based on JSON-RPC 2.0.

Guarantees:

  • Responses will be sent in the order in which the requests were sent.
  • Requests are processed atomically. This is also true for batch requests. I.e. while your request is being processed, no other request from any client is handled. Also, no notifications will be sent.
  • The individual responses of a batch response will have the same order as the individual requests of the corresponding batch request.
  • Notifications are not sent in batches.

subscribe

Subscribes this client to the feed of battle results.

Request

{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "id": 42
}

Response

{
  "jsonrpc": "2.0",
  "result": null,
  "id": 42
}

unsubscribe

Unsubscribes this client from the feed of battle results.

Request

{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "id": 42
}

Response

{
  "jsonrpc": "2.0",
  "result": null,
  "id": 42
}

get_battle_results

Sends all recorded battle results of the current gaming session to the client.

Params

  • after: optional timestamp to only replay battle results after the given timestamp. Can be omitted.

Request

{
  "jsonrpc": "2.0",
  "method": "get_battle_results",
  "params": {
    "after": 1587657932
  },
  "id": 42
}

Response

{
  "jsonrpc": "2.0",
  "result": {
    "start": 1587657932,
    "end": 1587659370,
    "battleResults": [ /* ... */ ]
  },
  "id": 42
}

subscription notification

Sent from the server when a new battle result has been received.

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "timestamp": 1587657932,
    "battleResult": { /* ... */ }
  }
}