Closed DaveLomber closed 4 years ago
I commented these 2 lines:
https://github.com/xmppjs/xmpp.js/blob/master/packages/client/index.js#L48 https://github.com/xmppjs/xmpp.js/blob/master/packages/client/index.js#L68
and it started to work
From my understanding, the lib should not send 'starttls' if we use wss as we already connect to secure port
And I replaced
let XMPPClient = require('@xmpp/client');
with
let XMPPClient = require('@xmpp/client/react-native');
and it started to work for Node WSS, as RN file does not use 'starttls' as I see
So I need some output here, what's the right way, is there an issue with lib for Node WSS etc
What is your XMPP server? It shouldn't offer starttls on Websocket.
Is it prosody? In which case it was fixed in version 0.10 .
We use Tigase
Okay so it's the same issue prosody had. Could you report the bug to Tigase and link it here?
Should be quite easy to workaround the issue in xmpp.js
.
See https://github.com/xmppjs/xmpp.js/blob/master/packages/starttls/client.js
Something like:
function isUsingNodeSocket(entity) {
// figure out a reliable way to find out if entity (client) transport is using a node.js net socket
return true || false
}
module.exports = function({streamFeatures}) {
return streamFeatures.use('starttls', NS, async (({entity}), next) => {
// https://github.com/xmppjs/xmpp.js/issues/807
if (!isUsingNodeSocket(entity)) {
return next()
}
await starttls(entity)
await proceed(entity)
await entity.restart()
})
}
I'd appreciate if you could give it a try. I'd be happy to help. Let me know.
Otherwise/Meanwhile, you could use @xmpp/client-core
instead of @xmpp/client
and exclude starttls.
See https://github.com/xmppjs/xmpp.js/blob/master/packages/client/index.js for an example
@sonnyp thank you for the detailed response I will check for Tigase
Meanwhile, the let XMPPClient = require('@xmpp/client/react-native');
way works currently for me, as it does not require 'starttls' at all.
I will also check for @xmpp/client-core
fixed in https://github.com/xmppjs/xmpp.js/pull/809
@DaveLomber I opened an issue with the Tigase project https://github.com/tigase/tigase-server/issues/10
released in v0.9.2
We are trying to use the lib against Node 10.x
But getting the following error when trying to connect