21 lines
No EOL
705 B
JavaScript
21 lines
No EOL
705 B
JavaScript
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
|
|
});
|
|
})
|
|
}); |