Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicekiwi/planetside-census-stream
https://github.com/nicekiwi/planetside-census-stream
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nicekiwi/planetside-census-stream
- Owner: nicekiwi
- Created: 2023-08-12T12:48:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-12T13:13:50.000Z (about 1 year ago)
- Last Synced: 2024-09-18T09:27:38.833Z (about 2 months ago)
- Language: TypeScript
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Planetside Census Stream
An API wrapper to access events of the game Planetside 2.
## Usage
```ts
import CensusStream from 'planetside-census-stream';
import { NamespaceType, StreamEventType } from 'planetside-census-data';const stream = new CensusStream(
platform: NamespaceType.PC,
serviceId: 's:example'
);stream.on('open', () => {
console.log('Connected to Census stream');stream.subscribe(
worlds: [WorldType.CONNERY],
eventNames: [StreamEventType.CHARACTER_DEATH]
);console.log('Subscribed to character Death events on Connery');
});stream.on(StreamEventType.CHARACTER_DEATH, (data: ServiceMessageResponse) => {
console.log(data);
});// Connected to Census stream
// Subscribed to character Death events on Connery
// {
// "payload":{
// "attacker_character_id":"5429026007696236657","attacker_fire_mode_id":"24103",
// "attacker_loadout_id":"1",
// "attacker_team_id":"2",
// "attacker_vehicle_id":"0",
// "attacker_weapon_id":"24003","character_id":"5429152843598287233","character_loadout_id":"32",
// "event_name":"Death",
// "is_critical":"0",
// "is_headshot":"0",
// "team_id":"1",
// "timestamp":"1681105322",
// "world_id":"1",
// "zone_id":"8"
// },
// "service":"event",
// "type":"serviceMessage"
// }```
Based on: https://github.com/Planetside-Community-Devs/planetside-stream-api