Streaming API Access for the Planetside2 API
npm install planetside-stream-apijs
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:
`js
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:
`js
api.on("FacilityControl", data => {
console.log(data);
});
`
If you want to unsubscribe again:
`js
api.unsubscribe(["13"], ["FacilityControl"]);
// Or unsubscribe from everything
api.unsubscribeAll()
`
$3
Im just going to assume you use npm to install this library
`sh
npm install planetside-stream-api
`
Running the tests
`sh
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
$3
We are using ESLint to check the library code for style issues.
To test run:
`sh
npm install
npm run lint
``