Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events do not fire #68

Closed
maciey opened this issue Feb 26, 2019 · 5 comments
Closed

Events do not fire #68

maciey opened this issue Feb 26, 2019 · 5 comments

Comments

@maciey
Copy link

maciey commented Feb 26, 2019

Hi All,

I need some guidance - not sure what Im doing wrong...
I can connect, send messages with this lib but I cant receive anything.
Below code worked well with s22.xmpp - not sure what changed how I should change it

Eg using below code I cant receive any messages nor status changes information

cl = new XmppClient(hostname, username, password);
cl.Message += Cl_Message; 
cl.StatusChanged += Cl_StatusChanged;
cl.Connect();
@ChristopheI
Copy link

ChristopheI commented Feb 26, 2019

Hi,
I had the same pb due to my my poor experience to XMPP and the way this library is working ...
You need to use the Service Discovery extension once connected in order to inform the server which XEP you are using.
I had to add code in XmppIm.cs for this ... Perhaps there is a best way but I don't know how.

The code looks like this:

// List of extensions we want to manage
Extension[] extensions = new Extension[] { Extension.Ping, Extension.MessageCarbons, Extension.MultiUserChat, Extension.ChatStateNotifications };
ServiceDiscovery serviceDiscovery = GetExtension<ServiceDiscovery>();
serviceDiscovery.Supports(core.Jid.Domain, extensions);

Hope this help.
Regards

NOTE: I'm working to add WebSocket support on this library. I have already a functional project for basic scenario (connection + presence + ping + message)

@maciey
Copy link
Author

maciey commented Feb 26, 2019

Many thanks replying. Im just starting with XMPP and this is still very dimmed area to me...
Can you please advise were precisely I should add those lines in XmppIm.cs
I try to search for serviceDiscovery / extensions etc but coudnt find good place
Appreciate if you can share wider context or XmppIm.cs file copy

** EDIT **

Ive added SetExtenstions() mrthod to IM:

public void SetExtenstions () {
      Extension[] extensions = new Extension[] { Extension.Ping, Extension.MessageCarbons,     Extension.MultiUserChat, Extension.ChatStateNotifications };
				
      ServiceDiscovery serviceDiscovery = GetExtension<ServiceDiscovery>();
      serviceDiscovery.Supports(core.Jid.Domain, extensions);
}

then I've called it after I made connection:

cl.Connect();				
cl.Im.SetExtenstions();

But still no luck :(

Can you plz advise what Im doing bad ?

@ChristopheI
Copy link

In file XmppIm.cs
In
public Roster Connect(string resource = null) { ... }
just after
EstablishSession();
It should worked.

I can't shared directly my fil since i'm adding webSocket support

@maciey
Copy link
Author

maciey commented Feb 26, 2019

Works well now ! Thanks !!!!
Issue can be closed now

BTW. Maybe you can also advice re #67 (How to get history from server)?
(Apologs being insistent but this is last functionality which stops me to switch to this great lib)

@marcel-landman
Copy link

@maciey There is a close button at the bottom of this page. Please use that to close this issue.

@maciey maciey closed this as completed Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants