jabber-net onAuthenticated doesn't get called

420 views Asked by At

I am using jabber-net as my xmpp chat client with C# application. Chat server I am using is apache vysper 0.7

I created chat client using following code.

 private void ChatOne_Load(object sender, EventArgs e)
    {
        JID jid = new JID("[email protected]");
        this.chatOneJabberClient.User = jid.User;
        this.chatOneJabberClient.Server = jid.Server;
        this.chatOneJabberClient.Password = "password1";
        //this.chatOneJabberClient.AutoPresence = false;
        //this.chatOneJabberClient.AutoRoster = false;
        //this.chatOneJabberClient.AutoReconnect = -1;
        this.chatOneJabberClient.OnAuthenticate += chatOneJabberClient_OnAuthenticate;
        this.chatOneJabberClient.OnError += chatOneJabberClient_OnError;
        this.chatOneJabberClient.OnReadText += chatOneJabberClient_OnReadText;
        this.chatOneJabberClient.OnWriteText += chatOneJabberClient_OnWriteText;
        this.chatOneJabberClient.Connect();
        this.chatOneJabberClient.Login();
        //done.WaitOne();
    }      

But what i understand from docs give over here is once the client is connected and login method is called it will automatically call the handler for OnAuthenticate.

When I try to send the message

private void button1_Click(object sender, EventArgs e)
    {
        this.chatOneJabberClient.Message("[email protected]", this.textBox2.Text);
        this.textBox2.Clear();
    }

It throws and invalid operation exception. User must be authenticated first.

Do let me know if you want any other information.

When jabberClient starts it calls the OnWriteText methoda handler and I can see following thing in my chat box:

Send: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="cb7f31d2" xmlns="jabber:client" to="test.com" version="1.0">

Do let me know if you need any further info.

1

There are 1 answers

0
Priyank Thakkar On

I figured out the issue.

The problem was with my chat server. I am using apache vysper. I was trying to use web-socket endpoint. In current version of vysper there is not much active development on web-socket. I changed it to TcpEndPoint and its all good. :)