Client library for interacting with the Planetside 2 Census API and Event Stream websocket, written in TypeScript. Current stable version is 4.9.1, actively maintained with regular releases. Key differentiators: unified interface for both Event Stream and REST API, built-in reconnection logic, subscription management, and support for community endpoints like Nanite Systems ESS. Requires Node.js 14+ and a DBG Census API Service ID. Optional peer dependencies bufferutil and utf-8-validate for performance.
npm install ps2censusNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a CensusClient to connect to the PS2 Event Stream, subscribing to MetagameEvents on world 10.
Use 'url' instead of 'endpoint' in the streamManager configuration.
Upgrade to Node.js 14 or later.
Use 'new Rest.Client('ps2', { serviceId: 'example' })' instead of passing serviceId as second string.Use lowercased first letter: 'facilityControl' not 'FacilityControl'.
Remove the 'duplicate' event listener and enable duplicate filtering in the client configuration.
Provide a valid DBG Census API Service ID as the first argument: new CensusClient('s:example', 'ps2');Install optional dependencies: npm install --save-optional bufferutil utf-8-validate
Use destructured require: const { CensusClient } = require('ps2census');Check network connectivity and verify the endpoint URL. Fall back to the official Census endpoint if needed.