Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook... ? #11

Closed
zzo opened this issue Jun 11, 2011 · 18 comments
Closed

Facebook... ? #11

zzo opened this issue Jun 11, 2011 · 18 comments

Comments

@zzo
Copy link
Contributor

zzo commented Jun 11, 2011

Howdy - I'm using JSJaC clone'd from git earlier today.
Am trying to add Facebook chat to my website.
I'm using node-xmpp-bosh as the bosh server.
I'm using NodeJS which is proxy'ing requests to node-xmpp-bosh.

So I loaded up your facebook example - I have a 'forever' access token so am not using any of your FB JS stuff - I just return my forever token from the getSession method in the FBConnection class (which is misspelled in the man JSJac class FWIW).

ANYWAYS so when I try to chat JSJaC is POST'ing to my endpoint:

I proxy this over to node-xmpp-bosh running on localhost:5280 & it returns:

Immediately - I don't think it's going to chat.facebook.com:5222.

SO... what am I doing wrong? Granted I have a very tenuous grasp of XMPP+BOSH...

thank you!!
Mark

@zzo
Copy link
Contributor Author

zzo commented Jun 11, 2011

Ah the XML didn't post here is the request from JSJaC:

<body content='text/xml; charset=utf-8' hold='1' xmlns='http://jabber.org/protocol/httpbind' to='undefined' wait='300' rid='584609' route='xmpp:chat.facebook.com:5222' secure='false' newkey='9972e987137ee3ba9da8bbd5b6c5fdc4e309f143' xml:lang='en' ver='1.6' xmlns:xmpp='urn:xmpp:xbosh'/>

and the response from I think node-xmpp-bosh:

<body xmlns="http://jabber.org/protocol/httpbind" condition="item-not-found" message="Invalid session ID" type="terminate"/>

@sstrigler
Copy link
Owner

Hi!

Sorry but I'm not into this FB Chat thing. I know that you can connect to FB using standard xmpp login methods but I don't know about this token auth. This patch has been added by someone else. So better ask him about things related to this option.

To me it looks like you forgot to set the 'domain' parameter as within the first request you can see the 'to' parameter being set to 'undefined' which is most likely not what you want. Probably it should be set to sth like 'chat.facebook.com' or 'facebook.com'.

Hope this helps, Steve

Am 11.06.2011 um 03:25 schrieb zzo:

Howdy - I'm using JSJaC clone'd from git earlier today.
Am trying to add Facebook chat to my website.
I'm using node-xmpp-bosh as the bosh server.
I'm using NodeJS which is proxy'ing requests to node-xmpp-bosh.

So I loaded up your facebook example - I have a 'forever' access token so am not using any of your FB JS stuff - I just return my forever token from the getSession method in the FBConnection class (which is misspelled in the man JSJac class FWIW).

ANYWAYS so when I try to chat JSJaC is POST'ing to my endpoint:

I proxy this over to node-xmpp-bosh running on localhost:5280 & it returns:

Immediately - I don't think it's going to chat.facebook.com:5222.

SO... what am I doing wrong? Granted I have a very tenuous grasp of XMPP+BOSH...

thank you!!
Mark

Reply to this email directly or view it on GitHub:
#11

@raindrop80
Copy link
Contributor

Hi!
The main problem I see it's that maybe your Node.js is not able to correctly redirect the request to Facebook domain.
I suggest you to test it with JabberHTTPBind running on a Tomcat server. You can find more on this servlet at the following address:

http://blog.jwchat.org/jhb/

Hope this helps,
Andrea

@ghost
Copy link

ghost commented Jun 11, 2011

Hi,

We are using node-xmpp-bosh on https://bind.jappix.com/ to run https://www.jappix.com/ - Jappix uses JSJaC - and it works well with the Facebook Chat server.

Anyway, I think the "route" attribute (when connecting) have to be removed in JSJaC, since the DNS SRV records replace it. The solution would be not to include it each time, just when a specific host & port is defined.

@zzo
Copy link
Contributor Author

zzo commented Jun 11, 2011

thanks all I'm getting closer:
I specified 'sasl' in the 'authtype' parameter to the JSJaCHttpBindingConnection constructor & then in JSJaCHttpBindingConnection I set this.authtype to oArgs.authtype so the 'sasl' block gets executed when building the request.
So now I'm getting a much bigger chunk back from FB servers (had to tell node-xmpp-bosh to NOT use TLS for chat.facebook.com).
I ALSO had to set:
this.authhost this.host = oArg.host || this.domain;
in JSJaCConnection as that sets the 'to' attribute in the XML......

SO anyways here's a dump of what I'm getting from node-xmpp-bosh:

http://pastebin.com/R2ajhFL3

Something about the authtype it doesn't like - I wanna use the X-FACEBOOK-PLATFORM type...

@ghost
Copy link

ghost commented Jun 11, 2011

And if you set oArgs.secure = true in the connect function? I had no problem using JSJaC + node-xmpp-bosh + Facebook Chat with this configuration!

@zzo
Copy link
Contributor Author

zzo commented Jun 11, 2011

thanks I just set secure to true & got the same result....

how are you proxying the connection to node-xmpp-bosh from JSJaC? My web page containing the JS is server from another port than 5280 so I gotta proxy JSJaC's connections thru my nodejs-based server over to node-xmpp-bosh...

@zzo
Copy link
Contributor Author

zzo commented Jun 11, 2011

Seems like the problem is around JSJaC sending:

<body rid='337932' sid='719e661e-5ba6-4ee3-a871-93250ad77b99' xmlns='http://jabber.org/protocol/httpbind' key='509f02c8259462c986a6ac05d62ba3564964d148' ><iq xmlns="jabber:client" type="get" id="auth1"><query xmlns="jabber:iq:auth"><username/></query></iq>

As later on FB responds with:

<iq from="chat.facebook.com" id="auth1" type="error"><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

and then it's done...

@raindrop80
Copy link
Contributor

Hi guys.
Did you saw the Facebook example I developed in the samples folder?
I think that the problems you are having is coming from your xmpp-bosh.
If it can help you I can setup a working online demo to let you show how it works.

Let me know..

@ghost
Copy link

ghost commented Jun 11, 2011

zzo, we are proxying to https://bind.jappix.com/ for Jappix Mini, and https://www.jappix.com/bind for the full Jappix, so no-cross-domain browsers can work with it.

@zzo
Copy link
Contributor Author

zzo commented Jun 12, 2011

right duh.

OMG I GOT IT WORKING!!! Unclear how it ever worked before actually.

I've forked this with my changes (not very many) here:

https://github.com/zzo/JSJaC

Please review - I'll issued a pull request -thanks!! Mark

The diffs & my comments on the diffs are here:

zzo@49b3432#commitcomment-426575

THANKS!!

@zzo
Copy link
Contributor Author

zzo commented Jun 12, 2011

BTW my changes should NOT effect any other XMPP action - just FB.

I -think- the ONLY line that may effect other XMPP action is this:

  • this.authhost = this.host = oArg.host || this.domain;

Maybe it should be:
this.host = oArg.host || this.domain;
if (!this.authhost) this.authhost = this.host;

??

in Connection.js ... thanks! Mark

@zzo
Copy link
Contributor Author

zzo commented Jun 12, 2011

So for grins my setup is:

Webpage -> my connect-based NodeJS webserver (which serves the JS & the rest of my app) -> proxied to -> node-xmpp-bosh -> chat.facebook.com - and back.

So my users can magically be on any page on the web & FB chatting - just what everyone always wanted... Crazy thing actually works.

@raindrop80
Copy link
Contributor

That's the main reason why I developed and shared the X-FACEBOOK-PLATFORM auth method.
I already developed four projects using it and they all works really great.

@mirzaarsalan
Copy link

plz help me i wanna connect to my website with fb chat but i cannot configure this JAJaC ????????
whhen ever i run jsjac.js file on node.js it return an error in the line
var scripts = document.getElementsByTagName("script");

@rraptorr
Copy link
Collaborator

rraptorr commented Oct 2, 2013

JSJaC is a client side JavaScript library, it is supposed to be run in a browser and allows one to build IM in a browser. It will not run on your nodejs server and will not allow you to connect your server to Facebook chat.

@mirzaarsalan
Copy link

sir plz guide me how is run this build IM in the browser whenever i run this i got this error
Uncaught ReferenceError: JsJaCFBApplication is not defined
how i configure this client side library ?????? help me or send me running code with complete configuration plzzzzzzzz

@mirzaarsalan
Copy link

and whenever i configure fb app it give me just 2 things app id and App Secret: not api key hows i get this??????

@mirzaarsalan
Copy link

Uncaught ReferenceError: FB is not defined ...............whenever i connect jsjac client to facebook chat server using HTTP Base (https://jappix.com/bind/fbchat) and other parameters as app id and secerte key................ plz tell me where is problem ...... and tell me how to connect my jsjac fb chat client to this xmpp-bosh server ( https://bind.jappix.com/ ) plz reply me as soon as possible ???????????????????????????

@rraptorr
Copy link
Collaborator

rraptorr commented Oct 6, 2013

Honestly, I have completely no idea what are you trying to do so I cannot help you. If you do have some problems please create a new issue, with detailed description of the problem and sample of the code you are having trouble with.

And please do use smaller amount of question marks, we really can see a single one;)

@mirzaarsalan
Copy link

sir simply tell me how i can use JSJaC facebook chat client to my website?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants