Giter VIP home page Giter VIP logo

xmpp_dart's People

Contributors

fluttercid avatar tatankaconcube avatar vavadiyahiren avatar vukoye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmpp_dart's Issues

Feature request: Authentication with JSON Web Token

Authentication with a JSON Web Token

It would be nice to have the possibility to authenticate with a JWT.

The idea is to have something similiar as what can be done with the smack library like

SASLAuthentication.registerSASLMechanism(new SASLJwtMechanism());
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
		.setSecurityMode(SecurityMode.required)
		.setUsernameAndPassword("username", "here comes the JWT")
		.setXmppDomain("example.com")
		.setHostAddress(ip)
		.setPort(5222)
		.setCustomX509TrustManager(new TrustAllTrustManager())
		.addEnabledSaslMechanism(SASLJwtMechanism.NAME)
		.build();
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
connection.connect().login();

with this SASLMechanism

public class SASLJwtMechanism extends SASLMechanism {

    public static final String NAME = "JWT";

    @Override
	protected void authenticateInternal(CallbackHandler cbh) throws SmackException {
        throw new UnsupportedOperationException("CallbackHandler not (yet) supported");
	}

	@Override
	protected byte[] getAuthenticationText() throws SmackException {
		return toBytes('\u0000' + authenticationId + '\u0000' + password);
	}

	@Override
	public String getName() {
		return NAME;
	}

	@Override
	public int getPriority() {
		return 410;
	}

	@Override
	public void checkIfSuccessfulOrThrow() throws SmackException {
        // No check performed
	}

	@Override
	protected SASLMechanism newInstance() {
		return new SASLJwtMechanism();
	}
}

So that it is possible to get the JWT on the XMPP Server (prosody) in order to verify it.

function provider.test_password(username, password)
	log("debug", "Verify JWT");
	return true;
end
...
function provider.get_sasl_handler()
	local supported_mechanisms = {};
	supported_mechanisms["JWT"] = true;
	return new_sasl(host, {
		token = function(sasl, username, password, realm)
			return usermanager.test_password(username, realm, password), true;
		end,
        mechanisms = supported_mechanisms
	});
end

Why failed host look up?

Hi,
Thanks for your work, it is impressive, but may I ask why below error happens, for my think, I think it is because of the server problem, because I have my own server ip, but how to change.

Type user@domain:
demo@shrs-tr2

Unhandled exception:
SocketException: Failed host lookup: 'shrs-tr2' (OS Error: nodename nor servname provided, or not known, errno = 8)
#0 _NativeSocket.lookup. (dart:io-patch/socket_patch.dart:386:9)
#1 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#2 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#4 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#5 Future._completeWithValue (dart:async/future_impl.dart:483:5)
#6 Future._asyncComplete. (dart:async/future_impl.dart:513:7)
#7 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#8 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#9 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)

WebSocket support

Hello,
As far as I can see the library doesn't have websocket support
Are there any plans to do so?

Lost connection error

Good day. If you lose the connection and try to reconnect, the error "You acknowledged stanzas that we didn't send. Your Ack h: 17, our last stanza: 5" is thrown and the connection is closed. This scenario repeats itself forever.

<stream:error xmlns:stream="http://etherx.jabber.org/streams"> <undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-streams"/> <text xmlns="urn:ietf:params:xml:ns:xmpp-streams">You acknowledged stanzas that we didn't send. Your Ack h: 377, our last stanza: 68 </text> </stream:error>

Flutter Web support

Can this work with Flutter Web?
Currently it shows error:

Socket error: Unsupported operation: InternetAddress

Probably because dart:io is not available on the web and it should use HtmlWebSocketChannel. Here is package that explains it a bit better: https://pub.dev/packages/web_socket_channel

Any help is appreciated.

Login Error.

When do login. I get the fllow error.
[log] ---Xmpp Receiving:---
[log] <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="192.168.86.88" id="2c0ifa1uie" xml:lang="en" version="1.0">stream:featuresPLAINSCRAM-SHA-1CRAM-MD5DIGEST-MD5zlib</stream:features>
[log] D/[Connection]: processInitialStream
[log] D/[ConnectionNegotiatorManager]: Negotiating features
[log] D/[ConnectionNegotiatorManager]: Found matching negotiator true
I/flutter (31622): ‼️ SEVERE 2021-05-17 16:08:28.330594 [caller info not available] RangeError (index): Invalid value: Valid value range is empty: 0
I/flutter (31622): ‼️ SEVERE 2021-05-17 16:08:28.331731 [caller info not available] #0 List._setIndexed (dart:core-patch/growable_array.dart:262:73)
I/flutter (31622): #1 List.[]= (dart:core-patch/growable_array.dart:258:5)
I/flutter (31622): #2 ScramSaslHandler.generateRandomClientNonce (package:xmpp_stone/src/features/sasl/ScramSaslHandler.dart:65:12)
I/flutter (31622): #3 new ScramSaslHandler (package:xmpp_stone/src/features/sasl/ScramSaslHandler.dart:42:5)
I/flutter (31622): #4 SaslAuthenticationFeature._process (package:xmpp_stone/src/features/sasl/SaslAuthenticationFeature.dart:51:23)
I/flutter (31622): #5 SaslAuthenticationFeature.negotiate (package:xmpp_stone/src/features/sasl/SaslAuthenticationFeature.dart:36:7)
I/flutter (31622): #6 ConnectionNegotiatorManager.negotiateNextFeature (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:79:25)
I/flutter (31622): #7 ConnectionNegotiatorManager.negotiateFeatureList (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:61:5)
I/flutter (31622): #8 Connection.handleResponse. (package:xmpp_stone/src/Connection.dart:306:43)
I/flutter (31622): #9 Ite

ReconnectionManager can't completely finish the reconnection flow

After making all attempts for reconnection ReconnectionManager tries to close the connection, but the state of Connection doesn't change to XmppConnectionState. Closed. It happens because the code doesn't pass this check.

The main problem - after this we can't connect/reconnect the chat connection. In this case, every attempt finished with state
XmppConnectionState.ForcefullyClosed after sending packer for resuming Stream Management.

There log with unsuccess relogin, in the end of log you can see ForcefullyClosed state

@vukoye can you please review this case?

UPD
Added log, change the description.

Bug report: Stream Management doesn't work after reconnect.

Version: 0.2.5

Did it work before: No, we had same issue on 0.2.3

Steps to reproduce:

  1. Connect to the chat:
String userJid = ""; // full user jid
xmpp.XmppAccountSettings accountSettings = xmpp.XmppAccountSettings.fromJid(userJid, password);
xmpp.Connection _connection = xmpp.Connection.getInstance(accountSettings);
_connection.connect();
  1. Close chant connection:
_connection.close();
  1. Connect again:
_connection.connect();

Actual result:
Request on enabling Stream management doesn't send.
Stream management ackRequests doesn't send to the server.

Expected result:
Request on enabling Stream management sends like after first login.
Stream management ackRequests send to the server every 5 second like after first login.

Additional info:
Looks like issue related with StreamManagementModule and ConnectionNegotatiorManager which uses singleton of StreamManagementModule and during second login it doesn't initialise, because already has state NegotiatorState.DONE.

remoteChatStream is not giving real-time chat status

xmpp.ChatManager.getInstance(widget.connection).getChat(widget.connection.fullJid).remoteStateStream.listen((status){

      print('Status: '+status.toString());

});

I am using this stream to get the active status of the opposite user. but it is only being called when we receive any new message from the opposite side.

I want it to show opposite user's active status in real-time independent of a message being received from the opposite side.

How can i establish XMPP server connection in background??

Currently i am able to make connection via normal connection.connect() method but it blocks my app UI for certain seconds which is not the best thing, because XMPP is still trying to establish connection with server which uses the MAIN THREAD.
This is the exact issue of which i am talking about.

How can i offload the establish connection process to some different isolates and i am not adhere to get its response back.
All i want is it should execute est. connection code in the background and not on the main thread.

If we've any workaround for this then it will not block UI because main thread is free to render UI.

migrate to null safety

Are there any plans?
on pub dev I haven't seen null safety support label that is why I opened this issue
Also on a side note, there is no github link in pub dev. It would be nice to link the github repo from there for simplicity.
https://pub.dev/packages/xmpp_stone

Cannot connect to ejabberd server.

Get's following error

!!!!!!Handle ERROR SocketException: Failed host lookup: '<#jid.domain#>' (OS Error: No address associated with hostname, errno = 7)
I/flutter ( 4294): State: XmppConnectionState.ForcelyClosed
I/flutter ( 4294): Connection forcely closed!

Found that this file (XmppAccountSettings.dart) have constructor name & host values which are not used!

import 'package:xmpp_stone/src/data/Jid.dart';

class XmppAccountSettings {
  String name;
  String username;
  String domain;
  String resource = '';
  String password;
  String host;
  int port;
  int totalReconnections = 3;
  int reconnectionTimeout = 1000;
  bool ackEnabled = true;

  XmppAccountSettings(this.name, this.username, this.domain, this.password, this.port, {this.host, this.resource} );

  Jid get fullJid => Jid(username, domain, resource);

  static XmppAccountSettings fromJid(String jid, String password) {
    var fullJid = Jid.fromFullJid(jid);
    return XmppAccountSettings(jid, fullJid.local, fullJid.domain, password, 5222);
  }
}

Thank you!

BOSH support

Hello, thanks for the library. Do you plan to add BOSH support in the near future?

Connections cannot be garbage collected

Hi Vukoye and thanks for the great package!

In my app, I have a need to re-create a Connection frequently with updated user credentials, this exposed a behavior which I think may be irrelevant in some use cases but undesirable in others: Connections cannot be garbage collected even after being closed and de-referenced by anything other than the xmpp_stone package itself.

Since a connection creates various instances of PresenceManager, Ping Manager, etc... and those instances are stored in static maps within those objects with the parent Connection instance being the key, a connection is always referenced by the package itself while instances of the various Manager objects are stored in those static maps.

Also the various Manager objects do not provide any static method so far to remove instances from the static instances maps.

To reproduce, simply create and close a Connection multiple times using buttons for example, giving enough time to create those Connections.

final someCredentials = XmppAccountSettings(<your account details here>);
Connection? myConnection;

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Example')),
      body: Container(
          child: Column(
        children: [
          ElevatedButton(
            onPressed: () {
              setState(() {
                myConnection = Connection(someCredentials);
              });
            },
            child: Text('Create XMPP Connection'),
          ),
          ElevatedButton(
            onPressed: () {
              myConnection?.close();
            },
            child: Text('Close XMPP Connection'),
          ),
        ],
      )),
    );
  }

After a few connections creation and close, user the dart devtools in the memory tab, you can take a heap snapshot and look at the xmpp_stone package. There should be the same amount of connections that the amount of time you clicked on the create button. You can try to manually trigger the garbage collector but those connections will just sit there and never be garbage collected, accumulating as more connections are created.

Connection_memory_leak

Also related is that "closed" connection timers can remain active. I often randomly see heartbeat message being sent (or logged as if they were sent):

[log] ---Xmpp Sending:---
[log] <r xmlns="urn:xmpp:sm:3"/>
[log] ---Xmpp Sending:---
[log] <r xmlns="urn:xmpp:sm:3"/>
[log] ---Xmpp Sending:---
[log] <r xmlns="urn:xmpp:sm:3"/>

In this case I believe it is because the timer in the StreamManagementModule sometimes is not canceled properly when a connection is closed. This is actually what got me on track to look up into all of the above...

I believe a lot of those behaviors come from a typical chat app use case where all connection are opened when the app is opened and are expected to stay active and never closed for the lifecycle of the app. But other use case for XMPP like mine may require a different approach.

I'll open a PR to fix the above issues without affecting the package behavior at all, it'll be a purely optional dispose method added to the Connection which can be used instead of close for those use cases like mine when garbage collection is desirable.

App is getting hanged up when calling connection.connect();

The app is getting hanged up when creating a new connection. I think it is doing a heavy job in the main thread. We must create a new thread and do processing there.

The issue is only coming in physical devices and not in the emulator.

var connection = xmpp.Connection(account); connection.connect();

SASL Handshake Authentication dropped / response unreceived by ejabberd server

I am running example.dart on emulator and connecting to ejabberd on localhost.

I got the connection to work by subbing the host parameter in XmppAmountSettings with the IP address from ifconfig, while keeping localhost as the domain. However, the connection is dropped when the ejabberd server doesn't seem to receive the response to the challenge for the SASL authentication.

Any idea why? Many thanks in advance! Thank you for creating this package.

UPDATE: I think my issue could also be with using a certificate from an untrusted authority, as Adium prompts me to continue to connect -- but in that case,

  1. should not ejabberd be showing that the authentication failed for that reason (& not a timeout)
  2. what can we do to accept untrusted connections for testing purposes / avoid this issue?

xmpp_dart log:

[log] <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="SCRAM-SHA-1">biwsbj10ZXN0MixyPStkQlI5RHI4K3VER3hBSlZmSVJJUU9oaFpmN2NrcmFqOS83aDJ1YTBQMEt0M1gxR1FtNFgrV2VuNjhvWDhScVY=</auth>
[log] D/[ConnectionNegotiatorManager]: ACTIVE FEATURE: {name: SaslAuthenticationFeature, name_space: null, priority: 1000, state: NegotiatorState.NEGOTIATING}, isReady: true
[log] ---Xmpp Receiving:---
[log] <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj0rZEJSOURyOCt1REd4QUpWZklSSVFPaGhaZjdja3JhajkvN2gydWEwUDBLdDNYMUdRbTRYK1dlbjY4b1g4UnFWTWQwWWF1VEFqcGUxMlIzRkpzcUxJZz09LHM9OEh3UUtBTzN3V2xHNEg2WmlqU2hiQT09LGk9NDA5Ng==</challenge>
[log] ---Xmpp Sending:---
[log] <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9K2RCUjlEcjgrdURHeEFKVmZJUklRT2hoWmY3Y2tyYWo5LzdoMnVhMFAwS3QzWDFHUW00WCtXZW42OG9YOFJxVk1kMFlhdVRBanBlMTJSM0ZKc3FMSWc9PSxwPVdlQ1VjdDBrYjdwN0RzaklMZlB5VWNNMVo0dz0=</response>
[log] ---Xmpp Receiving:---
[log] <stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Idle connection</text></stream:error>

ejabberd log:

20:43:19.953 [info]  (tls|<0.969.0>) Received XML on stream = "<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"SCRAM-SHA-1\">biwsbj10ZXN0MixyPStkQlI5RHI4K3VER3hBSlZmSVJJUU9oaFpmN2NrcmFqOS83aDJ1YTBQMEt0M1gxR1FtNFgrV2VuNjhvWDhScVY=</auth>"
 
20:43:19.954 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3
 
20:43:19.993 [info]  (tls|<0.969.0>) Send XML on stream = "<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj0rZEJSOURyOCt1REd4QUpWZklSSVFPaGhaZjdja3JhajkvN2gydWEwUDBLdDNYMUdRbTRYK1dlbjY4b1g4UnFWTWQwWWF1VEFqcGUxMlIzRkpzcUxJZz09LHM9OEh3UUtBTzN3V2xHNEg2WmlqU2hiQT09LGk9NDA5Ng==</challenge>"
 
20:43:19.994 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3
 
20:43:19.994 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3
 
20:43:19.994 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
20:43:28.592 [info]  (tls|<0.969.0>) Send XML on stream = "<stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Idle connection</text></stream:error>"
 
20:43:28.593 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

20:43:28.593 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

20:43:28.593 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3

20:43:28.593 [debug] Running hook :c2s_closed: :mod_stream_mgmt::c2s_closed/2

20:43:28.593 [debug] Running hook :c2s_closed: :ejabberd_c2s::process_closed/2

20:43:28.594 [debug] Running hook :c2s_terminated: :mod_stream_mgmt::c2s_terminated/2

20:43:28.594 [debug] Running hook :c2s_terminated: :mod_pubsub::on_user_offline/2

20:43:28.594 [debug] Running hook :c2s_terminated: :ejabberd_c2s::process_terminated/2

20:43:28.595 [info]  (tls|<0.969.0>) Send XML on stream = "</stream:stream>"

Here are truncated logs for a complete handshake for the same server with desktop Adium client, in case it is helpful:

21:18:29.641 [debug] Running hook :c2s_pre_auth_features: :mod_register::stream_feature_register/2
 
21:18:29.668 [info]  (tls|<0.1049.0>) Send XML on stream = "<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>SCRAM-SHA-512-PLUS</mechanism><mechanism>SCRAM-SHA-512</mechanism><mechanism>SCRAM-SHA-256-PLUS</mechanism><mechanism>SCRAM-SHA-256</mechanism><mechanism>SCRAM-SHA-1-PLUS</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features>"
 
21:18:29.670 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

21:18:29.670 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.670 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
21:18:29.681 [info]  (tls|<0.1049.0>) Received XML on stream = "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5' xmlns:ga='http://www.google.com/talk/protocol/auth' ga:client-uses-full-bind-result='true'/>"
 
21:18:29.681 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3

21:18:29.688 [info]  (tls|<0.1049.0>) Send XML on stream = "<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjE1MjM0NTQ1NjE2OTM3MTA1NDQ0Iixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>"

21:18:29.688 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

21:18:29.688 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.689 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
21:18:29.690 [info]  (tls|<0.1049.0>) Received XML on stream = "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRlc3QiLHJlYWxtPSJsb2NhbGhvc3QiLG5vbmNlPSIxNTIzNDU0NTYxNjkzNzEwNTQ0NCIsY25vbmNlPSI2MDk3N2Y2MTYxMjI0MzEwOTY0ZDdkMTNjIixuYz0wMDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwL2xvY2FsaG9zdCIscmVzcG9uc2U9ZTBiNjBiOGVjYzQ3OWIwMDQ1Y2M2Zjc3OWUyYmM3MDUsY2hhcnNldD11dGYtOA==</response>"
 
21:18:29.690 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3
 
21:18:29.694 [info]  (tls|<0.1049.0>) Send XML on stream = "<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cnNwYXV0aD04OTZhMTVkM2MwM2E3OTNhYzZlMGU5NzQzNzQ5ZGM2NQ==</challenge>"
 
21:18:29.694 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

21:18:29.694 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.694 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3

21:18:29.694 [info]  (tls|<0.1049.0>) Received XML on stream = "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>"

21:18:29.695 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3
 
21:18:29.696 [debug] Running hook :c2s_auth_result: :ejabberd_c2s::process_auth_result/3

21:18:29.697 [info]  (tls|<0.1049.0>) Accepted c2s DIGEST-MD5 authentication for test@localhost by mnesia backend from ::1

21:18:29.697 [debug] Running hook :c2s_auth_result: :mod_fail2ban::c2s_auth_result/3
 
21:18:29.699 [info]  (tls|<0.1049.0>) Send XML on stream = "<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>"

21:18:29.699 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

21:18:29.699 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.699 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3

21:18:29.699 [info]  (tls|<0.1049.0>) Received XML on stream = "<stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"

21:18:29.700 [info]  (tls|<0.1049.0>) Send XML on stream = "<?xml version='1.0'?><stream:stream id='9752890484746968509' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='localhost' xmlns='jabber:client'>"

21:18:29.700 [debug] Running hook :c2s_stream_started: :mod_client_state::c2s_stream_started/2
 
21:18:29.700 [debug] Running hook :c2s_stream_started: :mod_stream_mgmt::c2s_stream_started/2

21:18:29.700 [debug] Running hook :c2s_stream_started: :mod_fail2ban::c2s_stream_started/2
 
21:18:29.700 [debug] Running hook :c2s_post_auth_features: :mod_client_state::add_stream_feature/2
 
21:18:29.700 [debug] Running hook :c2s_post_auth_features: :mod_roster::get_versioning_feature/2
 
21:18:29.703 [debug] Running hook :c2s_post_auth_features: :mod_stream_mgmt::c2s_stream_features/2
 
21:18:29.705 [debug] Running hook :c2s_post_auth_features: :mod_caps::caps_stream_features/2
 
21:18:29.707 [debug] Running hook :disco_local_features: :mod_announce::disco_features/5
 
21:18:29.710 [debug] Running hook :disco_local_features: :mod_blocking::disco_features/5
 
21:18:29.710 [debug] Running hook :disco_local_features: :mod_carboncopy::disco_features/5

21:18:29.710 [debug] Running hook :disco_local_features: :mod_configure::get_local_features/5
 
21:18:29.716 [debug] Running hook :disco_local_features: :mod_offline::get_sm_features/5
 
21:18:29.716 [debug] Running hook :disco_local_features: :mod_privacy::disco_features/5

21:18:29.717 [debug] Running hook :disco_local_features: :mod_caps::disco_features/5

21:18:29.718 [debug] Running hook :disco_local_features: :mod_pubsub::disco_local_features/5
 
21:18:29.720 [debug] Running hook :disco_local_features: :mod_adhoc::get_local_features/5
 
21:18:29.720 [debug] Running hook :disco_local_features: :mod_disco::get_local_features/5
 
21:18:29.724 [debug] Running hook :disco_local_identity: :mod_announce::disco_identity/5
 
21:18:29.726 [debug] Running hook :disco_local_identity: :mod_configure::get_local_identity/5
 
21:18:29.726 [debug] Running hook :disco_local_identity: :mod_caps::disco_identity/5
 
21:18:29.726 [debug] Running hook :disco_local_identity: :mod_pubsub::disco_local_identity/5
 
21:18:29.726 [debug] Running hook :disco_local_identity: :mod_adhoc::get_local_identity/5
 
21:18:29.726 [debug] Running hook :disco_local_identity: :mod_disco::get_local_identity/5
 
21:18:29.728 [debug] Running hook :disco_info: :mod_offline::get_info/5
 
21:18:29.730 [debug] Running hook :disco_info: :mod_caps::disco_info/5
 
21:18:29.730 [debug] Running hook :disco_info: :mod_disco::get_info/5
 
21:18:29.735 [info]  (tls|<0.1049.0>) Send XML on stream = "<stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><c ver='NqMDrgCx03HLh3URMusgDnNsR30=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><ver xmlns='urn:xmpp:features:rosterver'/><csi xmlns='urn:xmpp:csi:0'/></stream:features>"
 
21:18:29.735 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3

21:18:29.735 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.735 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
21:18:29.736 [info]  (tls|<0.1049.0>) Received XML on stream = "<iq type='set' id='purple72c5e989'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>resource-name</resource></bind></iq>"
 
21:18:29.737 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3
 
21:18:29.737 [debug] Running hook :c2s_session_opened: :mod_carboncopy::c2s_session_opened/1
 
21:18:29.738 [info]  (tls|<0.1049.0>) Opened c2s session for test@localhost/resource-name
 
21:18:29.738 [info]  (tls|<0.1049.0>) Send XML on stream = "<iq type='result' id='purple72c5e989'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>test@localhost/resource-name</jid></bind></iq>"
 
21:18:29.738 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3
 
21:18:29.738 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.738 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
21:18:29.739 [info]  (tls|<0.1049.0>) Received XML on stream = "<iq type='set' id='purple72c5e98a'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>"
 
21:18:29.739 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3

21:18:29.739 [debug] Running hook :c2s_authenticated_packet: :mod_client_state::c2s_authenticated_packet/2

21:18:29.739 [debug] Running hook :c2s_authenticated_packet: :mod_stream_mgmt::c2s_authenticated_packet/2

21:18:29.739 [debug] Running hook :user_send_packet: :mod_privacy::user_send_packet/1

21:18:29.740 [debug] Running hook :user_send_packet: :mod_vcard_xupdate::user_send_packet/1

21:18:29.740 [debug] Running hook :user_send_packet: :mod_caps::user_send_packet/1

21:18:29.740 [debug] Running hook :user_send_packet: :mod_mam::user_send_packet/1

21:18:29.740 [debug] Running hook :user_send_packet: :mod_carboncopy::user_send_packet/1

21:18:29.740 [debug] Running hook :user_send_packet: :mod_mam::user_send_packet_strip_tag/1

21:18:29.740 [debug] Running hook :c2s_filter_send: :mod_client_state::filter_chat_states/1
 
21:18:29.740 [debug] Running hook :c2s_filter_send: :mod_client_state::filter_pep/1

21:18:29.740 [debug] Running hook :c2s_filter_send: :mod_client_state::filter_presence/1

21:18:29.741 [debug] Running hook :c2s_filter_send: :mod_client_state::filter_other/1

21:18:29.741 [debug] Won't add stanza for test@localhost/resource-name to CSI queue

21:18:29.741 [debug] Flushing packets of @localhost from CSI queue of test@localhost/resource-name
 
21:18:29.741 [info]  (tls|<0.1049.0>) Send XML on stream = "<iq xml:lang='en' to='test@localhost/resource-name' from='localhost' type='result' id='purple72c5e98a'/>"
 
21:18:29.741 [debug] Running hook :c2s_handle_send: :mod_push::c2s_stanza/3
 
21:18:29.741 [debug] Running hook :c2s_handle_send: :mod_push_keepalive::c2s_stanza/3

21:18:29.741 [debug] Running hook :c2s_handle_send: :mod_stream_mgmt::c2s_handle_send/3
 
21:18:29.741 [info]  (tls|<0.1049.0>) Received XML on stream = "<iq type='get' id='purple72c5e98b' to='localhost'><query xmlns='http://jabber.org/protocol/disco#items'/></iq><iq type='get' id='purple72c5e98c' to='localhost'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"
 
21:18:29.742 [debug] Running hook :c2s_handle_recv: :mod_stream_mgmt::c2s_handle_recv/3
 
21:18:29.742 [debug] Running hook :c2s_authenticated_packet: :mod_client_state::c2s_authenticated_packet/2
 
21:18:29.742 [debug] Running hook :c2s_authenticated_packet: :mod_stream_mgmt::c2s_authenticated_packet/2
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_privacy::user_send_packet/1
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_vcard_xupdate::user_send_packet/1
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_caps::user_send_packet/1
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_mam::user_send_packet/1
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_carboncopy::user_send_packet/1
 
21:18:29.742 [debug] Running hook :user_send_packet: :mod_mam::user_send_packet_strip_tag/1

21:18:29.743 [debug] Running hook :privacy_check_packet: :mod_last::privacy_check_packet/4
 
21:18:29.743 [debug] Running hook :privacy_check_packet: :mod_privacy::check_packet/4

May process SASL negotiation BEFORE STARTTLS negotiation

STARTTLS negotiation MUST be completed before proceeding to SASL negotiation, per Extensible Messaging and Presence Protocol (XMPP): Core 5.3.4.

If features returns from server as following:

<stream:features>
    <auth xmlns="http://jabber.org/features/iq-auth"/>
    <register xmlns="http://jabber.org/features/iq-register"/>
    <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
        <mechanism>SCRAM-SHA-1</mechanism>
        <mechanism>PLAIN</mechanism>
        <mechanism>ANONYMOUS</mechanism>
    </mechanisms>
    <ver xmlns="urn:xmpp:features:rosterver"/>
    <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
    <compression xmlns="http://jabber.org/features/compress">
        <method>zlib</method>
    </compression>
</stream:features>

xmpp_dart will process auth negotiation first, then starttls negotiation.

addRosterItem does not add the jid

Seems to be an issue in the addRosterItem method in RosterManager.dart:

itemElement.addChild(itemElement); should be queryElement.addChild(itemElement);

Also itemElement should get a name otherwise the name will be "null"

itemElement.name = "item";

Future<IqStanzaResult> addRosterItem(Buddy rosterItem) {
...
    XmppElement queryElement = XmppElement();
    queryElement.name = 'query';
    queryElement.addAttribute(XmppAttribute('xmlns', 'jabber:iq:roster'));
    iqStanza.addChild(queryElement);
    XmppElement itemElement = XmppElement();
    itemElement.name = "item"; //give a name to itemElement so it is not null.
    itemElement.addAttribute(XmppAttribute('jid', rosterItem.jid.userAtDomain));
    if (rosterItem.name != null) {
      itemElement.addAttribute(XmppAttribute('name', rosterItem.name));
    }
    queryElement.addChild(itemElement); //changed from itemElement.add to queryElement.add
    _myUnrespondedIqStanzas[iqStanza.id] = Tuple2(iqStanza, completer);
...
  }

Seems to be working once the above changes are made.

Also seems to be applicable to removeRosterItem but I haven't used that one yet.

XmppConnectionState.ForcefullyClosed

My Connection gets killed all the time.
How can I get detailed infos?

Thanks in advance for your help.

[log] D/[ReconnectionManager]: TimeOut is: 2000 reconnection counter 0
[log] D/[Connection]: State: XmppConnectionState.Reconnecting
[log] D/[Connection]: State: XmppConnectionState.SocketOpening
[log] D/[Connection]: State: XmppConnectionState.SocketOpened
[log] ---Xmpp Sending:---
[log]
<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'
to='jabber.econix.de'
xml:lang='en'

[log] D/[Connection]: Handle connection done
[log] D/[Connection]: State: XmppConnectionState.ForcefullyClosed
[log] D/[ReconnectionManager]: Connection forcefully closed!
[log] D/[ReconnectionManager]: TimeOut is: 2000 reconnection counter 0

do xmpp_dart support connect to xmpp server openfire now ?

hi,
@vukoye
thanks your work, I try connect to xmpp openfire server, bug not suceess. Maybe I don't know how to let it work,
My quection is xmpp_dart support connect to xmpp server openfire now ? If support , can add an example code ?
thankss.

my conect code like
//create connection

var userAtDomain = "u1@sky/jjg";
var password = "u1";
int  port = 5222;


xmpp.Jid jid = xmpp.Jid.fromFullJid(userAtDomain);
xmpp.XmppAccount account = xmpp.XmppAccount(userAtDomain, jid.local, jid.domain, password, port);
xmpp.Connection connection = new xmpp.Connection(account);
connection.open();

in ExampleConnectionStateChangedListener class

@override
 void onConnectionStateChanged(xmpp.XmppConnectionState state) {

   if (state == xmpp.XmppConnectionState.ReceivingFeatures) {
     print("ReceivingFeatures");   // just  get the status  
   }

   if (state == xmpp.XmppConnectionState.Authenticating) {
         print("Authenticating");
   }

   if (state == xmpp.XmppConnectionState.Closed) {
         print("Closed");
   }

print the string:
sending: <stream:stream
from='u1@sky'
to='sky'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>

in my spark , login string is

<stream:stream xmlns='jabber:client' to='sky' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='u1@sky' xml:lang='en'>

<stream:stream xmlns='jabber:client' to='sky' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='u1@sky' xml:lang='en'>
biwsbj11MyxyPSNDU096ckl8cmRuNDBUJnBIW1FycXsubFhPamY1T1Jz

How to setup priority and resources

I tried to set up resources as follow lines, however it did not work:

var userAtDomain = '$xmppId@$xmppDomain/Android';
    xmpp.Jid jid = xmpp.Jid.fromFullJid(userAtDomain);
    print("JID resources:" + jid.resource);
    xmpp.XmppAccountSettings account = xmpp.XmppAccountSettings(
        userAtDomain, jid.local, jid.domain, password, 5222);
    account.resource = "Android";

And I did not find any methods to setup presence's priority, do you have any ideas about it?

Feature request: Multi user chat

Would it be possible to add multi user chat feature to the library? What would be the effort to do this? I have tried out your library and it works great, but I would also need support for multi user chat later on.

Connection is disconnecting on stream error

I have installed this lib and checked that connection is happening very well only problem i can see here is it seems not sending the ping response to the server for the ping query and connection are dropping on three consecutive ping failure so couldn't use connection for more then 45 sec.

Here i am attaching the logs of the lib please check and if you can tell me where can i send pong response may be i can take a PR and fix this.

I/flutter (25562): response: <xmpp_stone><iq type="get" id="232-42788" to="6591791164@domain/a44y2hnstd" from="domain"><query xmlns="jabber:iq:version"/></iq></xmpp_stone>
I/flutter (25562): <xmpp_stone><iq type="get" id="232-42788" to="6591791164@domain/a44y2hnstd" from="domain"><query xmlns="jabber:iq:version"/></iq></xmpp_stone>
I/flutter (25562): response: <xmpp_stone><iq type="get" id="731-42789" from="domain" to="6591791164@domain/a44y2hnstd"><ping xmlns="urn:xmpp:ping"/></iq></xmpp_stone>
I/flutter (25562): <xmpp_stone><iq type="get" id="731-42789" from="domain" to="6591791164@domain/a44y2hnstd"><ping xmlns="urn:xmpp:ping"/></iq></xmpp_stone>
I/flutter (25562): response: <xmpp_stone></stream:stream></stream></xmpp_stone>
I/flutter (25562): State: XmppConnectionState.Closed

presence

hi, how do i send presence to another user.

HandShake Exception

while running the app it shows me the following error in log:

I/flutter (20230): DONE PARSING FATURES
I/flutter (20230): State: XmppConnectionState.DoneParsingFeatures
E/flutter (20230): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error: 
E/flutter (20230): 	CERTIFICATE_VERIFY_FAILED: self signed certificate(handshake.cc:354))
E/flutter (20230): #0      _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:103:51)
E/flutter (20230): #1      _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:832:21)
E/flutter (20230): #2      _RawSecureSocket._tryFilter.<anonymous closure> (dart:io/secure_socket.dart:953:13)
E/flutter (20230): #3      _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter (20230): #4      _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (20230): #5      _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
E/flutter (20230): #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
E/flutter (20230): #7      Future._propagateToListeners (dart:async/future_impl.dart:709:32)
E/flutter (20230): #8      Future._completeWithValue (dart:async/future_impl.dart:524:5)
E/flutter (20230): #9      Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:554:7)
E/flutter (20230): #10     _rootRun (dart:async/zone.dart:1126:13)
E/flutter (20230): #11     _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (20230): #12     _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter (20230): #13     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
E/flutter (20230): #14     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter (20230): #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter (20230): 

Unexpected Socket Error

E/flutter (30782): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: OS Error: Broken pipe, errno = 32, address = ludhyana.com, port = 50732
its going on wrong port

Error after bind resource - Unhandled Exception: Bad state: Cannot add event after closing

Hello guys, you are cool team and you did big work for implementation xmpp protocol on dart. Today I updated xmpp_stone to lates version (0.2.2) and I got unexpected issue, below detaile information about it.

Version: 0.2.2
Code to reproduce:

import 'package:xmpp_stone/xmpp_stone.dart' as xmpp;
...

String userJid = ""; // full user jid
xmpp.XmppAccountSettings accountSettings = xmpp.XmppAccountSettings.fromJid(userJid, password);

xmpp.Connection  _connection = xmpp.Connection.getInstance(accountSettings);

_connection.connect();

Error trace:

E/flutter ( 5677): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: Cannot add event after closing
E/flutter ( 5677): #0      _StreamController.add (dart:async/stream_controller.dart:596:24)
E/flutter ( 5677): #1      ConnectionNegotiator.state= (package:xmpp_stone/src/features/Negotiator.dart:24:37)
E/flutter ( 5677): #2      StreamManagementModule.negotiate (package:xmpp_stone/src/features/streammanagement/StreamManagmentModule.dart:91:7)
E/flutter ( 5677): #3      ConnectionNegotatiorManager.negotiateNextFeature (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:85:21)
E/flutter ( 5677): #4      ConnectionNegotatiorManager.stateListener (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:117:7)
E/flutter ( 5677): #5      _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter ( 5677): #6      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter ( 5677): #7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter ( 5677): #8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 5677): #9      _DelayedData.perform (dart:async/stream_impl.dart:594:14)
E/flutter ( 5677): #10     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:710:11)
E/flutter ( 5677): #11     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:670:7)
E/flutter ( 5677): #12     _rootRun (dart:async/zone.dart:1180:38)
E/flutter ( 5677): #13     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 5677): #14     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 5677): #15     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 5677): #16     _rootRun (dart:async/zone.dart:1184:13)
E/flutter ( 5677): #17     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 5677): #18     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 5677): #19     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 5677): #20     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter ( 5677): #21     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter ( 5677): 

Full log: stone_xmpp_error_log

XEP-0357: Push Notifications

How to send message that looks like this:

<iq type='set' id='some_random_id'>
  <enable xmlns='urn:xmpp:push:0' jid='hfhdemo.xyz' node='A14CD712-C862-4651-8F3F-24F281DBC6E4'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
      <field var='secret'><value>691d8009061936b0b0d31b99fd4053809f3efc2cf81327833c575360ed2595ac</value></field>
    </x>
  </enable>
</iq>

to register client for push notifications. I have the secret and node from app server, but sendMessage() only sends message with body. Is there any way to create custom messages?

https://xmpp.org/extensions/xep-0357.html#xmpp-architecture

Any help would be appreciated.

Hashed password storage for SCRAM

As is specified XMPP's wiki an added security and performance (less cpu time, memory usage, energy consumption and heat) feature is to store the users clientKey instead of password for future SCRAM authentication. I think creating an AuthInstance Class would be the best way to go about it. AuthInstance could have the username, password, iterations and salt during initial authentication, but could save username, saltedPassword, clientKey, iterations and clippedSalt for future authentication. Saving the saltedPassword, iterations and clippedSalt allows the client to either respond in the case of changed future authentication like if the server increased the iteration count and check to see if the password storage was fully rest which would change the salt. Only a clipped portion of the salt needs to be stored to see if the server changed the salt, this will make reversing the hash offline much harder. The repo would have an added parameter to the ScramSaslHandler or another function that takes AuthInstance as its argument.

Roster Manager Questions

I am trying to build a whatsapp clone. I decided to use ejabberd in the backend and flutter for frontend. For XMPP I decided to use this library.

In my application there's a flow like this

  1. Query XMPP for roster list
  2. If roster list is empty -> sync phonebook via REST API backend. Else, get roster list and write to sqlite db
  3. Display data from sqlite db to user.

Since the library requests for roster only at connectionState Ready

if (state == XmppConnectionState.Ready) {

Here's the problem I think I will face..

  1. XMPP Socket gets connected and is ready
  2. Send Request for roster
  3. Check if roster list is empty. If empty, sync via REST API.

Now the roster is updated in the backend.

But how to do I get this updated roster?
I'm assuming here, if you can expose the queryForRoster method I can use it to query for the roster again.
Please suggest any alternate mechanisms I can use.

SCRAM supports

Connection while App is closed

Hi! Is there a way to keep the connection in the background, even when the app is closed? I'm looking for a push notification service just like Firebase Cloud Messaging, but that works between my server and devices running on my local network.

Thank you for any feedback!

Can't login with different server and domain

Hi!

I was initially using this plugin with the same domain as the server name and it worked as expected, but I recently changed the domain name and I am having some trouble to make it work.
At first I had:

xmpp.XmppAccount _account = xmpp.XmppAccount('john.doe', '[email protected]', 'servername.com','password', 5222);
  xmpp.Connection connection = xmpp.Connection.getInstance(_account);
  connection.open();

and it worked perfectly but now I have:

  xmpp.XmppAccount _account = xmpp.XmppAccount('john.doe', '[email protected]', 'servername.com','password', 5222);
  xmpp.Connection connection = xmpp.Connection.getInstance(_account);
  connection.open();

and I am getting a

 response: <xmpp_stone><failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/><text xml:lang='en'>Invalid username or password</text></failure></xmpp_stone>

every time.

It is not a server problem because I am able to connect to the user with other clients like Pidgin.

XML dependency version is too low

This project currently depends on xml: '>=3.2.5 <4.0.0'.

This is a problem in projects which directly or indirectly depend on xml 4.x.x.

Can you add createdDate to MessageStanza

The offline messages are received without a created date(sent date)
So I need to know the created date of received messages to display them in order

Many thanks for your support of this helpful package.

Logout and second login with same user issue

Version: 0.2.3
Steps:

  1. create connection with User_1:
String userJid = ""; // full user jid
xmpp.XmppAccountSettings accountSettings = xmpp.XmppAccountSettings.fromJid(userJid, password);
xmpp.Connection _connection = xmpp.Connection.getInstance(accountSettings);
_connection.connect();
  1. close connection for User_1:
_connection.close();
  1. try connect again with same user:
_connection.connect();

I investigated code of your file Connection.dart and found issue here, I think you mean '=' instead of '==';

After changes in this place second login was started but didn't call all steps for login, just stoped after process features.

If you need more informations or logs, please let me know.

intl to any

Could you switch the intl requirement to any:

flutter : Because every version of xmpp_stone from git depends on intl ^0.16.1 and every version of flutter_localizations from sdk depends 
on intl 0.17.0-nullsafety.2, xmpp_stone from git is incompatible with flutter_localizations from sdk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.