LastFMDownloader/notification-client.js

21 lines
705 B
JavaScript
Raw Permalink Normal View History

require('dotenv').config();
const io = require('socket.io-client');
const notifier = require('node-notifier');
console.log(`${process.env.NOTIFICATION_CLIENT_PROTOCOL}://${process.env.NOTIFICATION_CLIENT_INSTANCE}:${process.env.NOTIFICATION_CLIENT_PORT}`);
const socket = io.connect(`${process.env.NOTIFICATION_CLIENT_PROTOCOL}://${process.env.NOTIFICATION_CLIENT_INSTANCE}:${process.env.NOTIFICATION_CLIENT_PORT}`, {reconnect: true});
socket.on('connect', function (s) {
notifier.notify({
title: 'LastFMDownloader',
message: 'Connected to notification server'
});
socket.on('message', (msg) => {
notifier.notify({
title: 'LastFMDownloader',
message: msg
});
})
});