93993793 by Jabis Sevon

interfacing with existing socket.io

1 parent 29484dc7
......@@ -1551,8 +1551,9 @@
Chart.defaults.global.elements.line.backgroundColor = "rgba(0,0,0,0)";
Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)";
Chart.defaults.global.elements.line.borderWidth = 2;
var socket = io.connect(location.protocol + '//' + location.hostname + ':' + location.port);
var config = {};
config.path = '/status';
var socket = io.connect(location.protocol + '//' + location.hostname + ':' + location.port+''+config.path);
var defaultSpan = 0;
var spans = [];
......@@ -1739,4 +1740,4 @@
</script>
</body>
</html>
\ No newline at end of file
</html>
......
......@@ -85,11 +85,12 @@
});
return (req, res, next) => {
if (io === null || io === undefined) {
if(global.socket) io = global.socket;
if (io === null || io === undefined || global.socket === undefined || global.socket === null) {
//console.log(req)
io = require('socket.io').listen(server);
io.on('connection', (socket) => {
}
io.of(config.path).on('connection', (socket) => {
socket.emit('start', config.spans);
socket.on('change', function() {
socket.emit('start', config.spans);
......@@ -101,7 +102,7 @@
span.responses = [];
setInterval(() => gatherOsMetrics(io, span), span.interval * 1000);
});
}
const startTime = process.hrtime();
if (req.path === config.path) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!