Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Avatar
prouser #1
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
Subject: XMPP connection to FaceBook Chat
Hello people!
I wrote my first test application for Windows Phone 7.
Authentication on facebook works, and all works fine except connection to chat.

According to MatriX tutorial I wrote this:

    private void button1_Click(object sender, RoutedEventArgs e)
    {
      Client.OnBeforeSasl += xmppClient_OnBeforeSasl;
      /*breakpoint1 here*/Client.Open();
    }

    private void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
    {
      /*breakpoint2 here*/e.Auto = false;
      e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
      e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
      {
        ApiKey = "xxxxxxxxxxxxx",
        ApiSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        SessionKey = AccessToken
      };
    }

Then I add a breakpoints where I marked.
But my program does not hit breakpoint2 =(
What I've done wrong?

And the next question: how can I determine that a connection was successful?
Client.Open() has no return value =(
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Are you using the Mango version of MatriX? You can only connect with the Mango version to Facebook. Because Facebook does not support Bosh, and all version before Mango support no sockets which are required for XMPP login to Facebook.

Alex
Avatar
prouser #3
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
Yes, I know it. I'm using emulator now. I've got own WP7 but without mango, that is why I using emulator.
Avatar
prouser #4
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
I think it is because I do not set server, or domain. Or are they automatically set after
e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM; ?
Avatar
Alex #5
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
of course you have to set the Xmpp domain chat.facebook.com before you open the connection.

Alex
Avatar
prouser #6
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
I've tried for two different variants but nothing changed =(

    private void button1_Click(object sender, RoutedEventArgs e)
    {
      Client.OnBeforeSasl += xmppClient_OnBeforeSasl;
      //v1! Client.SetXmppDomain("chat.facebook.com");
      //v2! Client.XmppDomain = "chat.facebook.com";
      Client.Open();
    }

    private void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
    {
      e.Auto = false;
      e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
      e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
      {
        ApiKey = "xxxxxxxxxxxxx",
        ApiSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        SessionKey = AccessToken
      };
    }
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please post your debug Xml if there is any.

Alex
Avatar
prouser #8
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
No, there is not any debug log.
I found this topic how to get it http://forum.ag-software.de/thread/721-How-can-I-post-my-D…,
But I have not got any OnReadXml or OnWriteXm in my XMPPClient.
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Then it does not connect at all to the Facebook server.

  • Are you using the correct dll for Mango?
  • Do you set all properties correct?
  • Are you on sockets and not on BOSH?

I suggest to play with the Desktop version and the MiniClient first with user, password login to Facebook. When this works then change to X_FACEBOOK_PLATFORM, when this works then port your code to WP7.

see also: http://www.facebook.com/help/?faq=223174657695137

Alex
Avatar
prouser #10
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
Ok, I will do all as you say.
But what do you mean saying
Are you using the correct dll for Mango?
I am using Emulator, what is the correct dll???
Avatar
Alex #11
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The correct MatriX dll for Windows Phone 7.1 Mango from here:
http://www.ag-software.net/download-directory/
Avatar
prouser #12
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
I have got this warning adding Windows Phone 7.1 Mango dll to my project.
And then this error


Error    1    Could not load the assembly file:///C:\Users\?????\Desktop\CS-WP7\Bin\Debug\Matrix.dll. This assembly may have been downloaded from the Web.  If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information.    MChat
The author has attached one file to this post:
.png 44.7 kBytes
You have no permission to open this file.
Avatar
Alex #13
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
And another problem will be the following changes:
http://developers.facebook.com/blog/post/555/

When Facebook applies the API changes from there you will not be able to connect from WP7 anymore. Because there is no SslStream class in the Wp7.1 Framework. So we are no able to create Tls secured connections.

Alex
Avatar
prouser #14
Member since Sep 2011 · 9 posts
Group memberships: Members
Show profile · Link to this post
So, it means I can't use XMPP protocol on my Windows Phone? And I cant use it in the emulator?
Avatar
Alex #15
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
No, this means that you will not be able to connect to Facebooks XMPP service anymore when these changes go in production.

You still are able to connect to any other XMPP server on the XMPP network which does not require Tls. This is not a restriction of MatriX, the problem is that Microsoft does not allow us to create secure socket connection with the current version of the WP7.1 SDK.

Alex
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:
Page:  1  2  next
Forum: MatriX RSS