Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
zbang.yaniv #1
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
Subject: Intro for dummies
Hello, I'm new to XMPP and chat discipline, and would like to evaluate your product and integrate it in my 3.5 Client Profile app.

Is there a simple example how to connect to gtalk, but really for dummies?

Are there prerequisites? Do I need to register somewhere (like jabber.org?) in order to operate the sample in the intro without getting NullReference and other exceptions?

Thank you
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by zbang.yaniv:
Hello, I'm new to XMPP and chat discipline, and would like to evaluate your product and integrate it in my 3.5 Client Profile app.

Is there a simple example how to connect to gtalk, but really for dummies?
the MiniClient example which is included with the download is what you are looking for.

Quote by zbang.yaniv:
Are there prerequisites? Do I need to register somewhere (like jabber.org?) in order to operate the sample in the intro without getting NullReference and other exceptions?

no, because Google-Talk, Facebook Chat and others are XMPP based you may have already an account for testing.
However I suggest to install your own XMPP server after your first tests for further testing and developing. Testing on a real server with developer code which often contains bugs is not ideal for you and the service providers ;-).
Avatar
zbang.yaniv #3
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply.

I do not seem to understand what's the username and server to fill.
I'd like to chat as zbang.yaniv@gmail.com on gtalk.

Is it:
username: zbang.yaniv
server: talk.google.com

(Note: I get some exceptions due to cross-thread ui operations while running the MiniClient)

Thank you
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by zbang.yaniv:
Is it:
username: zbang.yaniv
server: talk.google.com

no thats wrong

username: zbang.yaniv
server: google.com

for the Gmail Email address zbang.yaniv@google.com which is also your Jabber Id
This post was edited on 2011-03-09, 11:48 by Alex.
Avatar
zbang.yaniv #5
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
I'm sorry, I do not seem to make a progress. Please help me get started:

Even in the SendMessage sample below, the OnRosterEnd event isn't called. What am I missing?

class Program
    {
        static void Main(string[] args)
        {
            var xmppClient = new XmppClient
            {
                XmppDomain = "google.com",
                Username = "zbang.yaniv",
                Password = "******"
            };

            xmppClient.OnRosterEnd += delegate
            {
                xmppClient.Send(new Message
                {
                    To = "yanivpr@google.com",
                    Type = MessageType.chat,
                    Body = "Hello World"
                });

            };

            xmppClient.OnError += xmppClient_OnError;

            xmppClient.Open();

            Console.WriteLine("Press return key to exit the application");
            Console.ReadLine();

            xmppClient.Close();
        }

        private static void xmppClient_OnError(object sender, Matrix.ExceptionEventArgs e)
        {
          
        }
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
why don't you start with one of the existing examples which work?

Make sure that ResolveSrvRecords is true, and add the handlers OnReceiveXml and OnSendXml to receive your Xml debug.
Avatar
zbang.yaniv #7
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
Thank you for your patience

I have tried the MiniClient.

Upon Connect, I install and successfully import then accept the certificate (each time).
OnClose event is caught immediately afterwards with null state

(Upon pressing the 'PubSub' button, the OnError event is caught with NullReferenceException.)

Here's the debug data:

SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="google.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="google.com" id="5C972D51FE2C8283" version="1.0" xmlns="jabber:client" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
    <required />
  </starttls>
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-GOOGLE-TOKEN</mechanism>
  </mechanisms>
</stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="google.com" version="1.0" >

Can you tell what'a wrong?
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
normally just press "Ok" in the certificate dialog and Accept the cert in the next dialog.

You can also change the certificate handler to always accept the SSL certificate and ignore the warnings.

  1. private void xmppClient_OnValidateCertificate(object sender, CertificateEventArgs e)
  2. {
  3.    e.AcceptCertificate = true;
  4. }
Avatar
zbang.yaniv #9
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
Finally got it working.

Thanks!
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
great, any idea what the problem was?
Avatar
zbang.yaniv #11
Member since Mar 2011 · 29 posts
Group memberships: Members
Show profile · Link to this post
1) should have used gmail.com, not google.com
2) should have just accepted the certificate, not install it each time, and then accept

Not I'll try another sample, just using the matrix.dll

Thanks
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: