Unity & XMPP tag team

Good morning,

I was wondering if it's possible to use XMPP with Unity?

If there are .NET/Mono libraries available, that should work. Keep in mind, however, that - if you are building Web players - this will very likely make the Web player quite a bit larger since the assemblies need to be included (and it's very likely that these assemblies have dependencies to standard assemblies that then also need to be included).

For standalones, that shouldn't be much of an issue - but for Web players, it might be.

You could probably use one of the libraries listed here: XMPP Software: Libraries

Regarding the issue with Web players I've mentioned, read this for more details: Reducing included dlls in the Web Player (you'll need to scroll down to the bottom of the page).

I am looking at using XMPP for networking in Unity3d myself. No roadblocks so far, but I've only spent 8hrs looking into it all.

The Jabber-net assemblies add 860KB, which is almost trivial. You'd have some cost if you did it all yourself anyway.

As noted above, there may be dependencies that have to be added to a unity web-player build. I'll know more soon as I develop the idea further. But the references for the core Jabber-net assembly are the core ones plus System.XML and System.Security which should not need to be bundled.

As a side-question: is there a way for a web-player deploy to check what is available locally before sending assemblies? Perhaps a bootstrap process that creates a manifest is required.

Hi, there is in my github Working Library of XMPP implementation.

Should be good; be sure to only include client libraries (some implementations include both the client and server, which would be a lot bigger). We use the SmartFoxServer library, which is basically a XMPPish chat server + stuff. It's C# library just starts up a new thread to handle the server socket, and then has a "poll" function for you to call in FixedUpdate() which locks a "event queue" mutex, enqueues new events from the server on the main thread, and then unlocks the mutex so both threads can go merrily on their way.

xian1971 whats your status on this ? I was not able to get jabber-net working in webplayer build, while it works fine in standalone builds. I guess this is due to security stuff in the webplayer and jabber-net uses some .NET libs which are not allowed there. what a bummer, XMPP would habe been perfect for my chatting stuff and presence etc.

Does it work in Mobile?
I have tried it, but does not work in android.

Update request, Unity5
Did anyone get this working with their own xmpp server (OpenFire or Zentyal, or similar)?

I appear to have an accessible library (2005-jabber-net) and I have a logged SEND string, and a logged RECV string, which leads me to wonder that I need to change the stream header (a custom packet?) because it complains of an unknown host:

RECV: <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1087945903' from='sanitizeddomainname.com' xml:lang='en'><stream:error><host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error></stream:stream>

I’m not exactly sure how to get past the “xmlns:stream=‘http://etherx.jabber.org/streams’” thing…

As one might expect, this prevents the OnAuthenticate from firing, so no actual message gets sent yet…