vukoye / xmpp_dart

Lightweight XMPP client library written in Dart
Apache License 2.0
83 stars 64 forks source link

Connection error after update to 0.4.4-dev.1 #81

Closed N0Noorz closed 1 year ago

N0Noorz commented 1 year ago

when openning socket, got this response: [log] V/[Connection]: full response = <xmpp_stone><?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="192.168.5.110" id="2apj4gjuur" xml:lang="en" version="1.0"></stream:stream>

but in Connection.handleResponse: try { xmlResponse = xml.XmlDocument.parse(fullResponse.replaceAll('<?xml version=\'1.0\'?>', '')).firstChild; } catch (e) { _unparsedXmlResponse += fullResponse.substring( 0, fullResponse.length - 13); //remove xmpp_stone end tag xmlResponse = xml.XmlElement(xml.XmlName('error')); }

replaceAll Pattern not match

with server: Openfire 4.6.7 @TatankaConCube

TatankaConCube commented 1 year ago

@N0Noorz you are right, I will think about how to make a universal solution

TatankaConCube commented 1 year ago

@N0Noorz or or you can prepare a universal regex for removing the initial element from received packages, for now, they are the next variants:

<?xml version='1.0'?>
<?xml version='1.0' encoding='UTF-8'?>
TatankaConCube commented 1 year ago

I have prepared the fix and will publish it soon

TatankaConCube commented 1 year ago

@N0Noorz try the version 0.4.4-dev.2

N0Noorz commented 1 year ago

@N0Noorz try the version 0.4.4-dev.2

thx, may be there is other problem, when use 0.4.3-dev.1 is ok.

0.4.4-dev.2 got this log output: `[log] ---Xmpp Receiving:--- [log] I/flutter (11920): Authenticated [log] ---Xmpp Sending:--- [log] <?xml version='1.0'?> [log] D/[Connection]: State: XmppConnectionState.Authenticated [log] ---Xmpp Receiving:--- [log] <?xml version='1.0' encoding='UTF-8'?>zlib</stream:features>

TatankaConCube commented 1 year ago

@N0Noorz could you please point me to the issue? I can't see any issues here. Could you provide please the full log but format it, the single-line log is not readable.

N0Noorz commented 1 year ago

@TatankaConCube sorry for my reply. the new verison after 0.4.3, can't hanler this receiving: ConnectionNegotiatorManager not match any negotiator

[log] ---Xmpp Receiving:---
[log] <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="192.168.5.110" id="2ypedpcwdp" xml:lang="en" version="1.0"><stream:features><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><ver xmlns="urn:xmpp:features:rosterver"/><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional/></session><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://www.igniterealtime.org/projects/openfire/" ver="YclFS4eKP63ICwiAU9AIJ8otw3A="/></stream:features>

my test: image

in my case, rollback to use xmlResponse!.descendants is ok. https://github.com/vukoye/xmpp_dart/compare/development...N0Noorz:xmpp_dart:developmenthttps://github.com/vukoye/xmpp_dart/compare/development...N0Noorz:xmpp_dart:development

TatankaConCube commented 1 year ago

will be back to this issue later on next week

TatankaConCube commented 1 year ago

the version 0.4.4-dev.3 was published, please try it and close this ticket if the issue was resolved

N0Noorz commented 1 year ago

done. thx~