Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sefinek committed Oct 18, 2023
1 parent f2f63a8 commit 3d0f6eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions www/public/js/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ socket.onopen = () => {
console.log('WebSocket connection established.');
};

socket.onmessage = (event) => {
socket.onmessage = event => {
const parsedData = JSON.parse(event.data);

// Update elements on the page
Expand Down Expand Up @@ -43,7 +43,6 @@ socket.onerror = err => {
console.error('WebSocket connection error: ' + err.message);
};

// Function for updating statistics
function updateStats(id, value) {
const statsContentElement = document.getElementById(`stats-content-${id}`);

Expand Down
3 changes: 3 additions & 0 deletions www/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const RequestStats = require('./database/models/RequestStats');

module.exports = wss => {
wss.on('connection', ws => {
ws.on('error', console.error);


console.log('New WebSocket connection established.');

// Set up an interval to periodically send data to the connected client
Expand Down

0 comments on commit 3d0f6eb

Please sign in to comment.