XMPP library for .NET/Xamarin/.NET Core
The library consists of two NuGet packages:
License: LGPLv3
XMPP library for .NET/Xamarin/.NET Core
License: GNU Lesser General Public License v3.0
XMPP library for .NET/Xamarin/.NET Core
The library consists of two NuGet packages:
License: LGPLv3
I am using your library and pretty happy, I just looking for the MUC chat can you please guide me is this library supports MUC Conversation.
Thanks
I think it makes sense to define custom equality for the JID
type, because it is such a simple value object.
We need to migrate from that nasty project.json
back to orthodox csproj
.
JID parsing should be fixed to support nicknames with at-signs (e.g. nick@name).
Hi,
I am using Xamarin Forms and recently updated with latest Nuget package, it works fine in simulator but on connection it is crashing when I run on physical device.
Thanks
Hello,
For XmppComponent, the spec requires that the To field be the component name.
( to="componentname.domain" )
Could XmppTcpConnection be modified to use this format when connecting with the 'jabber:component:accept' namespace?
Hi,
I am able to use this library in simulator but on physical device I am getting the following error.
List of configured name servers must not be empty.
Parameter name: servers
LookupClient.QueryInternalAsync (DnsClient.DnsQuestion question, DnsClient.DnsQuerySettings queryOptions, System.Collections.Generic.IReadOnlyCollection`1[T] servers, System.Threading.CancellationToken cancellationToken)
SharpXMPP
XmppTcpConnection.ResolveHostAddresses (System.Threading.CancellationToken cancellationToken)
SharpXMPP
XmppTcpConnection.ConnectAsync (System.Threading.CancellationToken token
DEBUG Error
at DnsClient.LookupClient.QueryInternalAsync (DnsClient.DnsQuestion question, DnsClient.DnsQuerySettings queryOptions, System.Collections.Generic.IReadOnlyCollection`1[T] servers, System.Threading.CancellationToken cancellationToken) [0x00061] in <519bb9af32234e5dba6bd0b076a88151>:0
at SharpXMPP.XmppTcpConnection.ResolveHostAddresses (System.Threading.CancellationToken cancellationToken) [0x00089] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Shared/XmppTcpConnection.cs:307
at SharpXMPP.XmppTcpConnection.ConnectAsync (System.Threading.CancellationToken token) [0x00048] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Shared/XmppTcpConnection.cs:171
at SharpXMPP.Client.LoginPage.Login_Click (System.Object sender, System.EventArgs args) [0x0011d] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Xamarin/SharpXMPP.Client/LoginPage.xaml.cs:34
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:85
at SharpXMPP.Client.iOS.Application.Main (System.String[] args) [0x00001] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Xamarin/SharpXMPP.Client.iOS/Main.cs:12
Hi,
Using presence event handler I am able to get the realtime present of my friends those who attached to my roaster.
Now I can see the presence xml but little bit confuse how can I can easily fetch the Presence modes.
There is different xml for different modes likewise "Available , offline , away".
Following are all three types of presence xml. Just needed help is there any best approach is there to retrieve the presence from xml quickly or I need to parse/process the xml.
Available
<presence xml:lang="en" to="[email protected]/13095181656749857862393730" from="3458313788@ abc.com/gajim.233RA8V4" id="9b8943d3-aa0d-474c-9554-396ca73e3874" xmlns="jabber:client"> <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://gajim.org" ver="em/Gre+83xcNyMTMuavGSvT8wxA=" /> <x xmlns="vcard-temp:x:update" /> <delay from="[email protected]/gajim.233RA8V4" stamp="2020-09-23T16:59:29.126617Z" xmlns="urn:xmpp:delay" /> </presence>
offline
<presence xml:lang="en" to="[email protected]/13095181656749857862393730" from="[email protected]/gajim.233RA8V4" type="unavailable" id="e163f46e-e67c-4b60-ada6-e279ecadab8c" xmlns="jabber:client" />
Away
<presence xml:lang="en" to="[email protected]/13095181656749857862393730" from="[email protected]/gajim.233RA8V4" id="cc97741a-cb81-455b-9217-4cab9cb5842c" xmlns="jabber:client"> <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://gajim.org" ver="em/Gre+83xcNyMTMuavGSvT8wxA=" /> <x xmlns="vcard-temp:x:update" /> <show>away</show> </presence>
at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310
at SharpXMPP.XmppTcpConnection.InitTlsIfSupported (SharpXMPP.XMPP.Stream.Elements.Features features, System.Threading.CancellationToken cancellationToken) [0x000b7] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Shared/XmppTcpConnection.cs:343
at SharpXMPP.XmppTcpConnection.ConnectAsync (System.Threading.CancellationToken token) [0x00160] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Shared/XmppTcpConnection.cs:176
at SharpXMPP.Client.LoginPage.Login_Click (System.Object sender, System.EventArgs args) [0x000ef] in /Users/impro/Downloads/SharpXMPP-master/SharpXMPP.Xamarin/SharpXMPP.Client/LoginPage.xaml.cs:33
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Android.App.SyncContext+<>c__DisplayClass2_0.b__0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Java.Lang.IRunnable.cs:84
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.24(intptr,intptr)
Readme should describe the library purpose, capabilities, and proposed usage.
The library should periodically build on Travis and Appveyor.
var username = "3111";
var password = "3111";
var Client = new XmppClient
(new JID($"{username}@blah.com"), password, true);
Client.ConnectAsync();
BookmarkedConference bookmarkedConference = new BookmarkedConference();
bookmarkedConference.SetAttributeValue("JID", "[email protected]");
bookmarkedConference.SetAttributeValue("Nick", "John");
Client.BookmarkManager.Join
(bookmarkedConference);
After:
Can you add supports of :
"When using the SASL SCRAM mechanism, the SCRAM-SHA-256-PLUS variant SHOULD be preferred over the SCRAM-SHA-256 variant, and SHA-256 variants [RFC7677] SHOULD be preferred over SHA-1 variants [RFC5802]".
SCRAM-SHA-1(-PLUS):
-- https://tools.ietf.org/html/rfc5802
-- https://tools.ietf.org/html/rfc6120
SCRAM-SHA-256(-PLUS):
-- https://tools.ietf.org/html/rfc7677 since 2015-11-02
-- https://tools.ietf.org/html/rfc8600 since 2019-06-21: https://mailarchive.ietf.org/arch/msg/ietf-announce/suJMmeMhuAOmGn_PJYgX5Vm8lNA
SCRAM-SHA-512(-PLUS):
-- https://tools.ietf.org/html/draft-melnikov-scram-sha-512
SCRAM-SHA3-512(-PLUS):
-- https://tools.ietf.org/html/draft-melnikov-scram-sha3-512
https://xmpp.org/extensions/inbox/hash-recommendations.html
-PLUS variants:
LDAP:
HTTP:
2FA:
IANA:
Linked to:
Can you add OMEMO Encryption support?
OMEMO 0.3.0 is important to have compatibility with all clients:
After, can you update the XEP-0384: OMEMO Encryption support to 0.4.0+?
Hi,
I am using this library and pretty happy. Now I am looking to get information about the message delivery.
Is there any way I can track the message delivery information.
Thanks
{
"length": 0,
"offset": 0,
"id": "fd75c885-3fc1-4b52-8943-a7e28d1f2b30",
"exception": {
"type": "System.NullReferenceException",
"message": "Object reference not set to an instance of an object",
"stackTrace": " at SharpXMPP.XmppTcpConnection.InitTlsIfSupported (SharpXMPP.XMPP.Stream.Elements.Features features) <0x1065ec560 + 0x00038> in <af879d82b0fe4cf8b1d541279e6c3414#0835d9c74997d27a0e543614112fcf97>:0 \n at SharpXMPP.XmppTcpConnection.ConnectAsync (System.Threading.CancellationToken token) <0x1065ea9a0 + 0x0046f> in <af879d82b0fe4cf8b1d541279e6c3414#0835d9c74997d27a0e543614112fcf97>:0 \n at LumiDocTalk.ViewModel.VoipView_Model.ConnectXmppServer (System.String username, System.String password) <0x102ba6490 + 0x008bf> in <8a5d829cabcf4ba38d7fff223dc2c7f5#0835d9c74997d27a0e543614112fcf97>:0 ",
"wrapperSdkName": "appcenter.xamarin"
},
"appId": "0dbe2aac-d460-40c0-b8f7-d9d3254b8f7c",
"installId": "0B2BAEF7-5924-41AD-8789-1924E71E5E2F",
"isTestMessage": false,
"timestamp": "2021-07-02T20:59:30.639Z",
"sid": "0a528ea5-884e-47d6-a4eb-a6643720fe69",
"device": {
"sdkName": "appcenter.ios",
"sdkVersion": "4.1.1",
"wrapperSdkVersion": "4.2.0",
"wrapperSdkName": "appcenter.xamarin",
"model": "iPhone12,3",
"oemName": "Apple",
"osName": "iOS",
"osVersion": "14.6",
"osBuild": "18F72",
"locale": "en_PK",
"timeZoneOffset": 300,
"screenSize": "2436x1125",
"appVersion": "10.0",
"appBuild": "0.0.0.5",
"appNamespace": "----------",
"wrapperRuntimeVersion": "12.6.0"
}
}
Existing XmppWebSocketConnection.cs
was made before RFC7395 was released and needs to change framing namespace to "urn:ietf:params:xml:ns:xmpp-framing"
Hi, this issue concerns a few things:
XMPPWebSocketConnection
or XmppTcpConnection
and reopen them later? I don't see methods exposing some of these.XMPPWebSocketConnection
does not override Dispose
to dispose the WebSocket object. This may result in memory leaks.Hi,
I am looking to catch the ConnectionFailed Event but it does work as I expected.
I am using this library in my chat app using Xamarin Forms, It is working perfectly fine.
I noticed that when app at background for sometime so app disconnect from the xmpp server.
Now I wanted to know is there any way I can check the XmppClient connection state so that would help me see the connection state of the XmppClient to achieve the desired task.
Thanks
SharpXMPP.Shared
:
<PackageReference Include="SharpXMPP.Shared" Version="0.0.1-pre02" />
var x = new XMPPMessage();
x.Text = "hello world";
System.ArgumentException: An XObject cannot be used as a value.
at System.Xml.Linq.XContainer.GetStringValue(Object value)
at System.Xml.Linq.XElement.SetValue(Object value)
at SharpXMPP.XMPP.Client.Elements.XMPPMessage.set_Text(String value)
We have a nice api XmppTcpConnection::ConnectAsync(CancellationToken)
, but the token is completely ignored there.
This breaks an ability to cancel the connection.
Currently SharpXMPP may not work properly with non-ASCII symbols in JIDs and passwords, they should be normalised as described in RFC7564
We need to specify authors, license, etc. in our nuspec file.
For example, I'm trying to connect as [email protected]
, and it unfortunately tells me:
System.ArgumentException: None of the discovered or specified addresses match the socket address family.
Parameter name: addresses
at System.Net.Sockets.Socket.BeginConnect(IPAddress[] addresses, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress[] addresses, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.<>c.<ConnectAsyncCore>b__64_0(IPAddress[] targetAddresses, Int32 targetPort, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
at System.Net.Sockets.TcpClient.ConnectAsyncCore(IPAddress[] addresses, Int32 port)
at SharpXMPP.XmppTcpConnection.<Connect>d__15.MoveNext()
We need to set up NuGet publishing infrastructure and maybe even publish the first preview release.
Hi,
var roast = client.RosterManager.Roster;
Even at backend I have two friends in roster but this method always return 0
Secondly is there any way I can catch the roaster updates.
Thanks
Hi,
Please guys help me how can I do FileUploading.
Where can I find a simple example of creating a message to send?
SharpXMPP.XMPP.JID servjid = new SharpXMPP.XMPP.JID()
{
User = user, Domain = server, Resource = Environment.MachineName
};
var xmppClient = new SharpXMPP.XmppClient(servjid, pass, false);
// Do I have to create the XML or is there methods to do it?
xmppClient.sxmppClient.Send(?????????);
Object reference not set to an instance of an object.
at SharpXMPP.XMPP.Stanza.Parse[T](XElement src)
at SharpXMPP.XMPP.Client.Disco.InfoHandler.Handle(XmppConnection connection, XMPPIq element)
at SharpXMPP.XMPP.Client.IqManager.<>c__DisplayClass3_0.<Handle>b__0(PayloadHandler h)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at SharpXMPP.XMPP.Client.IqManager.Handle(XmppConnection sender, XMPPIq element)
at SharpXMPP.XmppConnection.OnIq(XMPPIq e)
at SharpXMPP.XmppTcpConnection.SessionLoop()
Hi,
I am using ejabberd with this client library in Xamarin Forms and pretty happy so far.
I am looking for File upload but this feature is not available in library. Can you please help me out or if any resources which are helpful so please share with me.
I have configured Rest api of ejabberd but not able to find the file upload api.
Please guide me is there any resource that help me to achieve this behavior.
Thanks
Hi, does SharpXMPP support the BOSH (Bi-directional streams Over Synchronous HTTP) XMPP extension? One use for this is Open Streaming Platform (OSP)'s chat, which uses XMPP/BOSH, and it would awesome to be able to use this library to connect a bot to the chat. Thank you!
Hi.
What's the use of Capabilities
why does it creates a Node http://bggg.net.ru/caps
?
Code from SharpXMPP.Shared/XmppConnection.cs
protected XmppConnection(string ns)
{
queries = new Dictionary<string, Action<XMPPIq>>();
_ns = ns;
Capabilities = new CapabilitiesManager
{
Identity = new Identity
{
Category = "client",
IdentityType = "mobile",
IdentityName = "SharpXMPP"
},
Node = "http://bggg.net.ru/caps",
Features = new List<string>
{
Namespaces.DiscoInfo,
Namespaces.DiscoItems
}
};
IqManager = new IqManager
{
PayloadHandlers =
{
new InfoHandler(Capabilities),
new ItemsHandler()
}
};
Iq += IqManager.Handle;
}
Hi all,
I'm new for Xamarin chat app. I find a function in this project. How to use XmppRegisterHandler.cs to register a new account ? Also need add/remove roster, thanks.
Currently the compilation of XmppSocketConnection
class is disabled. I had to disable it in scope of .NET Core porting, because it uses WebSocket4Net
, but there's no WebSocket4Net
dependency in the project and I had no time to address that properly.
What should we do now? There's an issue #6. @vitalyster, do you have plans to revive this class in its scope?
It is possible to have a XEPs and RFCs support page with version (XEP-XXXX v1.2)?
Examples:
Please add support of last RFCs.
About XMPP RFCs:
Difference noted in RFCs:
Note:
RFC3920 -> RFC6120
RFC3921 -> RFC6121
Draft but Very Important:
Linked to:
Say I want to add a custom IQ handler (e.g. for XMPP Ping or whatever).
Currently, we offer no way for the user to add such handler, since we recreate the IQManager
every time we need to handle an IQ query, and it is no ability to override it from the user side:
SharpXMPP/SharpXMPP.WebSocket/XmppWebSocketConnection.cs
Lines 73 to 80 in 78fec16
SharpXMPP/SharpXMPP.Shared/XmppTcpConnection.cs
Lines 294 to 304 in 3c7e866
The reason is in this line of code:
Prosody closes the XML correctly, thus it will just start returning false
in loop instead of trying to read more from the stream and failing.
Hi.,
I am looking to add some custom fields into XMPPMessage. Its pretty simple to modify the project and add custom fields but is there any way out there to add custom field with the existing XMPPMessage class and use it without modifying the code. Or is there any possibility to send message by setting custom attributes and process the attribute value on receiving end.
Like this
var message = new XMPPMessages
{
ID=Guid.NewGuid().ToString(),
Text = "Hi",
To = new JID("[email protected]")
};
message.SetAttributeValue("type", "Urgent");
Client.Send(message)
Could you please add a License file to the project?
Hi
I am using ejabberd server and connecting through the static ip of the server , It is working fine in windows and console apps but on Xamarin forms I am not able to even connect both in android and iOS.
This is error on Android.
at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310
at SharpXMPP.XmppTcpConnection.InitTlsIfSupported (SharpXMPP.XMPP.Stream.Elements.Features features) [0x000bf] in <4f194704292d40ad8605a7be061cbf71>:0
at SharpXMPP.XmppTcpConnection.ConnectAsync (System.Threading.CancellationToken token) [0x00160] in <4f194704292d40ad8605a7be061cbf71>:0
at LumiDocTalk.Views.Dashboard.OnAppearing () [0x00274] in /Volumes/MySSD/Projects/LumiMobile/LumiDocTalk/LumiDocTalk/LumiDocTalk/Views/Dashboard.xaml.cs:58
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.