Fixed json send bug

This commit is contained in:
Eunchong Kim 2021-08-08 14:14:49 +09:00
parent b5bd28fd45
commit 8eb35f4da3

View File

@ -46,9 +46,10 @@ wss.on('connection', (ws) => {
setInterval( () => { setInterval( () => {
var data = { var data = {
ctrl: 'idle', ctrl: 'idle',
time: new Date().toTimeString() date: new Date()
} }
wss.clients.forEach( (client) => { wss.clients.forEach( (client) => {
client.send( data ); // Send the msg object as a JSON-formatted string.
client.send( JSON.stringify( data ) );
}); });
}, 30000); // 30 s }, 30000); // 30 s