Connecting Unity client to XMPP server

Viewed 15

I'm trying to make a client for chat using unity.

I have found this library https://github.com/bilelmnasser/Unity-3D-Xmpp-Protocol-

so I've imported to my project and being testing the code but I can't seem to get it to work.

using UnityEngine;
using Xmpp;
using Xmpp.protocol.client;

public class NewBehaviourScript : MonoBehaviour
{

// Start is called before the first frame update
void Start()
{
    var xmppClient = new XmppClientConnection("localhost");
    //xmppClient.ConnectServer = "ipServer";
    xmppClient.Server = "localhost";
    xmppClient.Port = 5222;
    xmppClient.Username = "admin@localhost";
    xmppClient.Password = "password";
    xmppClient.Open();
    xmppClient.OnLogin += delegate(object o) { xmppClient.Send(new Message("user@localhost", MessageType.chat, "Hello, how are you?")); };

}

Here is my code. I have a ejabberd server running using docker. I've created two users and tested on node server as client and it worked fine, but can't get to work on unity...

any help would be great!

0 Answers
Related