Skip to content

Instantly share code, notes, and snippets.

@Friss
Created February 27, 2019 04:38
Show Gist options
  • Save Friss/ce57372fd655bfd0d9424a69acaec6f6 to your computer and use it in GitHub Desktop.
Save Friss/ce57372fd655bfd0d9424a69acaec6f6 to your computer and use it in GitHub Desktop.
csgo twitch extension
"Observer All Players v.1"
{
"uri" "http://127.0.0.1:3000"
"timeout" "0.5"
"buffer" "0.5"
"throttle" "1.0"
"heartbeat" "10.0"
"auth"
{
"token" "Q79v5tcxVQ8ud"
}
"data"
{
"map_round_wins" "1" // history of round wins
"map" "1" // mode, map, phase, team scores
// "player_id" "1" // steamid
// "player_match_stats" "1" // scoreboard info
// "player_state" "1" // armor, flashed, equip_value, health, etc.
// "player_weapons" "1" // list of player weapons and weapon state
// "provider" "1" // info about the game providing info
// "round" "1" // round phase and the winning team
// Below this line must be spectating or observing
// "allgrenades" "1" // grenade effecttime, lifetime, owner, position, type, velocity
"allplayers_id" "1" // the steam id of each player
"allplayers_match_stats" "1" // the scoreboard info for each player
// "allplayers_position" "1" // player_position but for each player
"allplayers_state" "1" // the player_state for each player
// "allplayers_weapons" "1" // the player_weapons for each player
// "bomb" "1" // location of the bomb, whos carrying it, dropped or not
// "phase_countdowns" "1" // time remaining in tenths of a second, which phase
// "player_position" "1" // forward direction, position for currently spectated player
}
}
http = require('http');
fs = require('fs');
var winston = require('winston');
winston.add(winston.transports.File, {
filename: 'player-stats-public.log',
json: true,
timestamp: false,
});
port = 3000;
host = '127.0.0.1';
server = http.createServer(function(req, res) {
if (req.method == 'POST') {
res.writeHead(200, { 'Content-Type': 'text/html' });
var body = '';
req.on('data', function(data) {
body += data;
});
req.on('end', function() {
winston.log('info', body);
res.end('');
});
} else {
winston.log('info', 'Not expecting other request types...');
res.writeHead(200, { 'Content-Type': 'text/html' });
var html =
'<html><body>HTTP Server at http://' +
host +
':' +
port +
'</body></html>';
res.end(html);
}
});
server.listen(port, host);
winston.log('info', 'Listening at http://' + host + ':' + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment