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:
parent
4510a709d4
commit
38f5d3b66a
7 changed files with 84 additions and 21 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue