Merge pull request #18 from H4CK3R-01/monitoring_functions
Added monitoring functions
This commit is contained in:
commit
3773fb427b
@ -1,9 +1,10 @@
|
||||
let express = require('express');
|
||||
let fs = require('fs');
|
||||
let app = express();
|
||||
let server = require('http').createServer(app);
|
||||
let {Server} = require("socket.io");
|
||||
let io = new Server(server);
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const {instrument} = require("@socket.io/admin-ui");
|
||||
const app = express();
|
||||
const server = require('http').createServer(app);
|
||||
const {Server} = require("socket.io");
|
||||
const io = new Server(server);
|
||||
let cards = JSON.parse(fs.readFileSync(__dirname + '/../data/fragen_10_06_21_final_new_format.json'));
|
||||
|
||||
let port = 5000;
|
||||
@ -11,10 +12,22 @@ server.listen(port, function () {
|
||||
generate_log_message("MAIN", "Server", 'RUNNING', "PORT " + port);
|
||||
});
|
||||
|
||||
// Monitor websockets
|
||||
instrument(io, {
|
||||
auth: {
|
||||
type: "basic",
|
||||
username: process.env.WEBSOCKET_MONITOR_USERNAME,
|
||||
password: process.env.WEBSOCKET_MONITOR_PASSWORD
|
||||
},
|
||||
serverId: `${require("os").hostname()}#${process.pid}`
|
||||
});
|
||||
|
||||
|
||||
// Serve static files (html, css, js)
|
||||
app.use(express.static(__dirname + '/../public'));
|
||||
|
||||
|
||||
// Websockets
|
||||
io.on('connection', socket => {
|
||||
let addedUser = false;
|
||||
|
||||
@ -114,5 +127,5 @@ function shuffleAnswers(card) {
|
||||
|
||||
function pad(width, string, padding) {
|
||||
if (string === undefined || string === null) return pad(width, " ", " ");
|
||||
return (width <= string.length) ? string : pad(width, string + padding, padding)
|
||||
return (width <= string.length) ? string : pad(width, string + padding, padding);
|
||||
}
|
2042
package-lock.json
generated
2042
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
||||
"name": "projektmanagement-game",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@socket.io/admin-ui": "^0.1.2",
|
||||
"express": "^4.17.1",
|
||||
"socket.io": "^4.1.2"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user