Last active
November 7, 2015 12:57
-
-
Save swallentin/948d705281eee508147b to your computer and use it in GitHub Desktop.
How to subscribe to server events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var StatsManager = require('./lib/StatsManager'), | |
| statsManager = StatsManager.create(), | |
| onServerEvent = function (data) { | |
| console.log('Event type:', data.TYPE); | |
| console.log('Server origin:', data.SERVER); | |
| console.log('Message payload:', data.DATA) | |
| }; | |
| statsManager.on('PLAYER_CONNECT', onServerEvent); | |
| statsManager.on('PLAYER_DISCONNECT', onServerEvent); | |
| statsManager.on('PLAYER_SWITCHTEAM', onServerEvent); | |
| statsManager.on('MATCH_STARTED', onServerEvent); | |
| statsManager.on('PLAYER_STATS', onServerEvent); | |
| statsManager.on('MATCH_REPORT', onServerEvent); | |
| statsManager.on('PLAYER_DEATH', onServerEvent); | |
| statsManager.on('PLAYER_KILL', onServerEvent); | |
| statsManager.on('PLAYER_MEDAL', onServerEvent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "STEAM_ID": "1234", | |
| "RANK": { | |
| "DUEL": { | |
| "elo": 1300, | |
| "glicko": 433 | |
| }, | |
| "TDM": { | |
| "elo": 1300, | |
| "glicko": 433 | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment