planetside-stream-api

Streaming API Access for the Planetside2 API

Usage no npm install needed!

<script type="module">
  import planetsideStreamApi from 'https://cdn.skypack.dev/planetside-stream-api';
</script>

README

Planetside 2 Stream API Wrapper

License: MIT GitHub issues npm

An API wrapper to access events of the game Planetside2

Getting Started

First of all you have to create the Api object:

var PlanetsideWrapper = require("planetside-stream-api");
var constants = require("planetside-stream-api/lib/constants");

var api = new PlanetsideWrapper(constants.SERVERS.PC);

// Or if you have a service id: 
var api = new PlanetsideWrapper(constants.SERVERS.PC, "example");

Now you need to subscribe to some events:

api.on("open", () => {
    console.log("Connected to Census!");
    api.subscribe(["13"], ["FacilityControl"]);
});

And then you can access all events as part of nodes events module:

api.on("FacilityControl", data => {
    console.log(data);
});

If you want to unsubscribe again:

api.unsubscribe(["13"], ["FacilityControl"]);
// Or unsubscribe from everything
api.unsubscribeAll()

Installing

Im just going to assume you use npm to install this library

npm install planetside-stream-api

Running the tests

git clone https://github.com/Planetside-Community-Devs/planetside-stream-api.git
cd planetside-stream-api
npm install
npm test

For additional information of the library on runtime use the debug scope planetside-stream-api

And coding style tests

We are using ESLint to check the library code for style issues. To test run:

npm install
npm run lint

Built With

  • WS - Used to connect to the websocket api - MIT Licensed
  • debug - Used to debug the library - MIT Licensed

Authors

  • Soundofdarkness (Laura Schäfer) - Currently Everything - Soundofdarkness

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Daybreak for creating the game and api