1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-19 03:29:37 +02:00

Added WebSockets with funcionality to send messages from any module

This commit is contained in:
unknown 2021-05-19 17:17:24 +02:00
parent 4510a709d4
commit 38f5d3b66a
7 changed files with 84 additions and 21 deletions

View file

@ -1,10 +1,12 @@
const schedule = require('node-schedule');
const getExternalWeather = require('./getExternalWeather');
const Sockets = require('../Sockets');
const weatherJob = schedule.scheduleJob('updateWeather', '0 */15 * * * *', async () => {
try {
await getExternalWeather();
console.log('weather updated');
Sockets.getSocket('weather').socket.send('weather updated');
} catch (err) {
console.log(err);
}