pgstath / Sharp.Xmpp

Sharp.Xmpp is looking for a maintainer! Unfortunatelly I do not have currently the time needed to maintain the library. Luckily a small but vibrant community has evolved around Sharp.Xmpp. If you would like to be the project's maintainer please sent an email to pgstath@gmail.com. This should include issues, tickets and commits that you have done for Sharp.Xmpp or other similar project. Sharp.Xmpp is a multiplatform, Windows and Android, .NET XMPP client assembly.Sharp.Xmpp supports IM functionality & a variety of XMPP extensions, is simple and is extensively tested against Android Xamarin. It is a fork of the currently frozen excellent S22.Xmpp project. Sharp.Xmpp will be at the FOSSDEM 2016 Real time DevRoom!
Other
84 stars 51 forks source link

Events do not fire #68

Closed maciey closed 3 years ago

maciey commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 3 years ago

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