mirror of
https://github.com/bitinflow/server.git
synced 2026-03-13 13:35:53 +00:00
refactor server
* shows some basic statistics on main page * move tcp proxy setup into separate file * migrate github page theme to be hosted locally
This commit is contained in:
37
static/js/index.js
Normal file
37
static/js/index.js
Normal file
@@ -0,0 +1,37 @@
|
||||
var eio = require('engine.io-client');
|
||||
var flipCounter = require('flip-counter');
|
||||
|
||||
var request_counter = new flipCounter('request-count', {
|
||||
value: 0,
|
||||
pace: 10,
|
||||
fW: 30,
|
||||
tFH: 20,
|
||||
bFH: 40,
|
||||
bOffset: 200,
|
||||
auto: false
|
||||
});
|
||||
|
||||
var user_counter = new flipCounter('user-count', {
|
||||
value: 0,
|
||||
pace: 10,
|
||||
fW: 30,
|
||||
tFH: 20,
|
||||
bFH: 40,
|
||||
bOffset: 200,
|
||||
auto: false
|
||||
});
|
||||
|
||||
var socket = eio('/');
|
||||
socket.on('open', function () {
|
||||
});
|
||||
|
||||
socket.on('message', function (data) {
|
||||
var msg = JSON.parse(data);
|
||||
request_counter.incrementTo(msg.requests);
|
||||
user_counter.incrementTo(msg.tunnels);
|
||||
});
|
||||
|
||||
socket.on('close', function () {
|
||||
request_counter.incrementTo(0);
|
||||
user_counter.incrementTo(0);
|
||||
});
|
||||
Reference in New Issue
Block a user