forked from vxmppb/vxmppb
Get messages from MQTT
catching ctrl+c
This commit is contained in:
parent
2462dce4f8
commit
d62efc18bf
19
index.js
19
index.js
|
@ -112,6 +112,16 @@ try {
|
||||||
|
|
||||||
// setup friends list
|
// setup friends list
|
||||||
const friends = Object.keys(config.friends);
|
const friends = Object.keys(config.friends);
|
||||||
|
client.subscribe('phones/pixel2/media', function (err) {
|
||||||
|
if (!err) {
|
||||||
|
debug();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
client.on('message', function (topic, payload) {
|
||||||
|
var nowPlaying = payload.toString()
|
||||||
|
console.log(nowPlaying)
|
||||||
|
xmpp.send(user_jid, nowPlaying)
|
||||||
|
})
|
||||||
|
|
||||||
xmpp.on('online', function (data, to) {
|
xmpp.on('online', function (data, to) {
|
||||||
// once we're online, we'll send a message alerting xmpp admins
|
// once we're online, we'll send a message alerting xmpp admins
|
||||||
|
@ -482,7 +492,7 @@ try {
|
||||||
for (const key in config.friends) {
|
for (const key in config.friends) {
|
||||||
// send xmpp message to friends alerting of new room
|
// send xmpp message to friends alerting of new room
|
||||||
xmpp.send(key, "Meeting started");
|
xmpp.send(key, "Meeting started");
|
||||||
// authorize users
|
// authorize users
|
||||||
const addMember = {
|
const addMember = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: xmpp_api_url + 'set_room_affiliation',
|
url: xmpp_api_url + 'set_room_affiliation',
|
||||||
|
@ -526,6 +536,7 @@ try {
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
debug();
|
debug();
|
||||||
|
xmpp.send(from, "Alright. Starting a new meeting: " + xmpp_muc_name + "@" + xmpp_muc_server + " and inviting friends");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,6 +637,12 @@ try {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on('SIGINT', function() {
|
||||||
|
console.log("\r\n SigInt receieved. Shutdown eminent!")
|
||||||
|
xmpp.send(user_jid, "SigInt receieved. Shutdown eminent!")
|
||||||
|
process.exit();
|
||||||
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Please create a config.ini");
|
console.log("Please create a config.ini");
|
||||||
console.log("See https://wiki.vanderwarker.family/doku.php?id=code:vxmppb:install:start");
|
console.log("See https://wiki.vanderwarker.family/doku.php?id=code:vxmppb:install:start");
|
||||||
|
|
Reference in New Issue
Block a user