PlanetSide 2 Live Population API
Find a file
2022-11-20 22:19:55 -05:00
.github/workflows docker stuff 2022-11-20 22:19:55 -05:00
services docker stuff 2022-11-20 22:19:55 -05:00
terraform initial commit 2022-11-20 14:49:35 -05:00
.dockerignore docker stuff 2022-11-20 22:19:55 -05:00
.gitignore initial commit 2022-11-20 14:49:35 -05:00
Cargo.lock basically everything is done uwu 2022-11-20 21:18:30 -05:00
Cargo.toml initial commit 2022-11-20 14:49:35 -05:00
docker-compose.yaml api done 2022-11-20 16:25:17 -05:00
Dockerfile docker stuff 2022-11-20 22:19:55 -05:00
README.md docker stuff 2022-11-20 22:19:55 -05:00

Saerro Listening Post

PlanetSide 2 live population API. This API is free and open for anyone to use.

https://saerro.harasse.rs

Our methodology is to add any player ID seen on the Census websockets to a time-sorted set, and returning the number of player IDs seen within 15 minutes.


The one and only goal of this app is to provide a current "point-in-time" population status for PlanetSide 2, per world, per faction, (and later, per continent.) Historical info is not a goal; you may implement this on your end.

Please open an issue here or get in touch with Pomf (okano#0001) on the PS2 Discord if you have complex use cases for this data; it may be trivial/easy to implement APIs tailored to your needs.

The main use case is for Medkit bot to have an in-house source of population data, without relying too heavily on any third-party stats service, like Fisu, Honu, or Voidwell; which all have different population tracking needs and goals (and thus, different data.)

API Reference

This API will never return a failure unless the app itself is failing. If you request a world ID that doesn't exist, it only sees an empty set, and will not 404. Since 0 can both mean a server is down and it doesn't exist, be mindful of the data. It could even mean the Websockets have failed.

This API only supports GET, and supports CORS.

  • / - Shows a help/usage message.

    {
      "worldID": 17,
      "total": 1000,
      "factions": {
        "tr": 334,
        "nc": 333,
        "vs": 333
      }
    }
    
  • /m/?id={worldID1},{worldID2}... - Shows populations for all listed worlds, example:

    {
      "worlds": [
        {
          "worldID": 17,
          "total": 1000,
          "factions": {
            "tr": 334,
            "nc": 333,
            "vs": 333
          }
        },
        {
          "worldID": 19,
          "total": 1000,
          "factions": {
            "tr": 334,
            "nc": 333,
            "vs": 333
          }
        }
      ]
    }
    

Architecture

  • Websocket processors
  • API
  • Redis
    • Using ZADD with score as timestamp, ZCOUNTBYSCORE by timestamp in 15 minute windows, and cleaned up with SCAN+ZREMBYSCORE, population data is tracked.
    • There is deliberately no persistence.
  • Redis "Tender"
    • Cleans up Redis every 5 mins.