10-09-2020 02:13 PM - edited 10-09-2020 02:25 PM
We have a web integration with Jabber that stopped working when we upgraded to 12.5 SU3.
https://developer.cisco.com/docs/jabber-web/#!im-and-presence-overview/overview
#CODE#
require('dotenv').config({path: __dirname +"/.env"});
var xmpp = require('simple-xmpp');
/* Connect to Cisco / XMPP Service */
xmpp.connect({
jid: process.env.JABBER_ID,
password: process.env.JABBER_PASSWORD,
host: process.env.JABBER_HOST
});
/* Watch for Status changes */
xmpp.on('buddy', function (jid, state, statusText, resource) {
if (resource == "composed") {
// let value = Object.keys(io.sockets.in(jid).connected).length
// console.log(value);
console.log('%s is in %s state - %s -%s', jid, state, statusText, resource);
io.to(jid).emit('presenceChange', { email: jid, status: state, statusText: statusText });
}
});
/* Create server */
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);
io.setMaxListeners(0);
http.listen(process.env.PRESENCE_PORT);
/* Await connection */
io.on('connection', function (socket) {
/* User joins room */
socket.on('join', function (data) {
var userId = data.jid.toLowerCase();
console.log("user joined", userId);
socket.join(userId );
/* Get inital status */
xmpp.probe(userId , function (state, statusText) {
xmpp.subscribe(userId);
io.to(userId).emit('presenceChange', { email: userId , status: state, statusText: statusText });
});
});
/* Should be used by editing to ensure user is 'friend' */
socket.on('subscribe', function(data) {
console.log("newsubscription:",data.jid);
xmpp.subscribe(data.jid);
});
});
#ERROR#
{ Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('XMPP authentication failure')
at EventEmitter.emit (events.js:187:17)
at Client.<anonymous> (D:\Node-JS-Apps\Jabber\node_modules\simple-xmpp\lib\simple-xmpp.js:477:20)
at Client.emit (events.js:198:13)
at Client._handleAuthState (D:\Node-JS-Apps\Jabber\node_modules\node-xmpp-client\lib\Client.js:295:10)
at Client._handleStanza (D:\Node-JS-Apps\Jabber\node_modules\node-xmpp-client\lib\Client.js:233:12)
at Client.onStanza (D:\Node-JS-Apps\Jabber\node_modules\node-xmpp-client\lib\Client.js:221:8)
at Connection.emit (events.js:198:13)
at Connection.onStanza (D:\Node-JS-Apps\Jabber\node_modules\node-xmpp-core\lib\Connection.js:377:10)
at StreamParser.<anonymous> (D:\Node-JS-Apps\Jabber\node_modules\node-xmpp-core\lib\Connection.js:231:10)
at StreamParser.emit (events.js:198:13) context: 'XMPP authentication failure' }
10-15-2020 11:17 AM
What version were you using before the upgrade? If you were using 11.5, for example, you need to change your BOSH port from 7335 to 5280.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide