I want the bot owner of the XMPP room to be persistently present, but I keep disappearing from the room and have to rejoin. What must I do to maintain my presence in a room? Is it configurable? I cannot find an answer in XEP-0045.
http://xmpp.org/extensions/xep-0045.html
Here is my code:
function daemonPresence(callback) {
var ElizaBot = require('./eliza');
var eliza = new ElizaBot();
var initial = eliza.getInitial();
var XMPP = require('stanza.io');
var administrator = 'metalaureate@' + config.get('xmpp.domain');
var client = XMPP.createClient({
jid: administrator,
password: 'password',
transport: 'bosh',
boshURL: config.get('xmpp.bosh_url')
});
client.enableKeepAlive();
client.on('session:started', function () {
console.log(administrator + ' is sending presence');
client.joinRoom("[email protected]", 'Daemon');
setInterval(function () {client.sendPresence();console.log('daemon presence');},60000);
client.on('chat', function (msg) {
console.log(msg.body);
var reply = eliza.transform(msg.body);
client.sendMessage({
to: msg.from,
body: 'hello world' // 'You sent: ' + msg.body
});
});
client.on('groupchat', function (msg) {
console.log('group chat', msg.body);
});
});
client.on('session:end', function (result) {
console.info("daemon session ended, restarting");
setTimeout(function () {
daemonPresence();
}, 10000);
// callback(null, result);
});
client.on('session:error', function (error) {
console.err('xmpp error', error);
callback(error, null);
});
client.connect();
}