Facebook Chat and Server question

423 views
Skip to first unread message

James Jeffery

unread,
Mar 20, 2011, 5:53:18 AM3/20/11
to jaxl
I have went through all your tutorials and I'm kind confused because I
want to run my chat bot from the web browser. I am also using shared
hosting so 2 questions:

1) Can I use JAXL to create a web based chat application that uses
Facebook chat?

2) Can I install JAXL on a shared host. I don't have SSH on the shared
host so I cant do nothing via the commant line.

Thanks :D

Anil Dewani

unread,
Mar 20, 2011, 12:39:52 PM3/20/11
to ja...@googlegroups.com
To create web based chat application via jaxl, you need an xmpp over
bosh enabled jabber server. Unfortunately, facebook servers aren't
bosh enabled.
You can still execute command lines using functions like exec() and
system() using php. Some shared hosting block such functions, so make
sure they are enabled.

> --
> You received this message because you are subscribed to the Google Groups "jaxl" group.
> To post to this group, send email to ja...@googlegroups.com.
> To unsubscribe from this group, send email to jaxl+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jaxl?hl=en.
>
>

nicola73

unread,
Mar 21, 2011, 12:51:42 PM3/21/11
to ja...@googlegroups.com
Facebook servers aren't bosh enabled, but you can use your bosh server to connect to facebook.

So, you can create a facebook web client, but like said on http://developers.facebook.com/docs/chat/ you must use X-FACEBOOK-PLATFORM if you use a bosh server that proxies the XMPP connection.

I tested it with facebook PHP-SDK + jaxl + BOSH (Punjab) + X-FACEBOOK-PLATFORM and it work perfectly.

Nicola

2011/3/20 Anil Dewani <anilde...@gmail.com>

Vamsi

unread,
Mar 23, 2011, 11:37:51 PM3/23/11
to jaxl
hi nicola,

can you please let us know how you did it ?



On Mar 21, 9:51 pm, nicola73 <nicol...@gmail.com> wrote:
> Facebook servers aren't bosh enabled, but you can use your bosh server to
> connect to facebook.
>
> So, you can create a facebook web client, but like said onhttp://developers.facebook.com/docs/chat/you must use X-FACEBOOK-PLATFORM
> if you use a bosh server that *proxies the XMPP connection.*
>
> I tested it with facebook PHP-SDK + jaxl + BOSH (Punjab) +
> X-FACEBOOK-PLATFORM and it work perfectly.
>
> Nicola
>
> 2011/3/20 Anil Dewani <anildewan...@gmail.com>

nicola73

unread,
Mar 24, 2011, 3:44:19 PM3/24/11
to ja...@googlegroups.com
You can start by hacking the boshchat example from 2.1.2.

you must firt acquire the session_key from facebook with the facebook php-sdk (take a look at the example.php in php-sdk to do this).

modify the bosh chat like this:

1) inizialize jaxl:
$jaxl = new JAXL(array(
            'user'=>$me['name'], /this from facebook sdk
            'pass'=>'',
            'domain'=>'chat.facebook.com',
            'port'=>5222,
            'boshHost'=>'localhost',
            'authType'=>'X-FACEBOOK-PLATFORM',
            'logLevel'=>4
        ));


2) add the function to get the key:

function getFacebookKey() {
            global $appSecret, $appAPI, $session;
            return array(
                $appSecret, // Your application secret key
                $appAPI, // Your application api key
                $session['session_key'] // Connecting user session key
            );
        }

3) add the facebook plugin:

$jaxl->addPlugin('jaxl_get_facebook_key', 'getFacebookKey');

4) modify the connect case:

case 'connect':           
                $jaxl->startCore('bosh');
                $jaxl->auth('X-FACEBOOK-PLATFORM');
                break;


Now you shuld be connected. I Hope this helps, and sorry for my english!

Nicola


2011/3/24 Vamsi <vvamsi...@gmail.com>

WiraCode

unread,
Mar 24, 2011, 10:11:52 PM3/24/11
to jaxl
@Nicola

"""I tested it with facebook PHP-SDK + jaxl + BOSH (Punjab) +
X-FACEBOOK-PLATFORM and it work perfectly. """

Hmmm... Must using Python for running JAXL?
It's like we calling back pyfacebook (just alike) and combine with
JAXL..?
Not have other solution for running this stuff through Web Server?

-WiraSyah-
> 2011/3/24 Vamsi <vvamsikris...@gmail.com>

Abhinav Singh

unread,
Mar 25, 2011, 5:48:58 AM3/25/11
to jaxl
Hi James/Anil/Nicola/Wira,

Nicola is right, and you SHOULD use an external BOSH server if you
want your users to be able to chat with fb friends via browser.
This is simply because fb doesn't provides a BOSH end point (5280
port) for direct connection. They only have (5222 tcp) port opened.

So here is how you can use facebook SDK + Jaxl + BOSH server:
1) User is on the browser application boshchat.php
2) Your JAXL config array will look like this:
new JAXL(array('host'=>'chat.facebook.com',
'domain'=>'chat.facebook.com', 'boshHost'=>'localhost',
'boshPort'=>5280));
3) Here i assume you have a BOSH server running at localhost:5280/http-
bind

Thereafter everything should be smooth and work fine.

@Wira
You really don't need any python code here ;)

WiraCode

unread,
Mar 25, 2011, 9:42:37 PM3/25/11
to jaxl
Hi Abhinav...

I mean BOSH (Punjab) on web server. It's using Python to setup their
script.
I can't find any article for running JAXL without adding other script
for Web Hosting...
I try using 2.1.2 and I got : [[XMPP]] Unable to open socket to the
jabber host
Any help/tips?

WiraCode

unread,
Mar 25, 2011, 10:06:07 PM3/25/11
to jaxl
I try the code like this...

$jaxl = new JAXL(array('user'=>$prof-
>username,'pass'=>'','host'=>'chat.facebook.com','domain'=>'chat.facebook.com','boshHost'=>'localhost','boshPort'=>5280,'authType'=>'X-
FACEBOOK-PLATFORM','logLevel'=>4));
function getFacebookKey(){global $sec,$api,$ses;return array($sec,$api,
$ses);}

So the possible way is must using BOSH (Punjab) to running code like
this? Not have other solutions...
Sorry to ask something like this, I'm familiar with PHP, ASP, Ruby and
other code, but this is first time using your code...
I think if your code can run without using other script, It's will be
good than using another sample to running Facebook Chat...
Sorry for my English lang and lot thanks if this problem can
settle... :)

WiraCode

unread,
Mar 25, 2011, 11:21:33 PM3/25/11
to jaxl
@Abhinav
Haha... You're handzome... ooopssss awesome!!!!

Already fixed that :)

On Mar 25, 4:48 pm, Abhinav Singh <mailsforabhi...@gmail.com> wrote:

Richa Singh

unread,
Mar 25, 2011, 11:27:24 PM3/25/11
to ja...@googlegroups.com, WiraCode
wiracode im clueless wat was fixed??

Abhinav Singh

unread,
Mar 26, 2011, 10:28:29 AM3/26/11
to jaxl
@wiracode
can you guys kindly fork out jaxl github apps directory so that we
have a repository of common usage examples for everyone.
It will be better to have such a repo instead of solving issues here
on groups in various separate threads.
what do you guys/gals think??

WiraCode.Com

unread,
Mar 26, 2011, 2:54:40 PM3/26/11
to ja...@googlegroups.com
@Abhinav
I try my best to learn this code. After my own project finished and can run on standard web hosting without any problem,
I'll tell you what I got from this stuff... I learn much code before and I think you have the best one for running all Chat platform :)
Reply all
Reply to author
Forward
0 new messages