How to connect to XMPP server from Javascript
I've been looking around for information about XMPP and JavaScr-er, ECMAScript and XMPP. After doing some research, i found Strophe. It looks intriguing and i was able to get some code to compile (always a starting point for me :) ) but no connection was actually being made. That's when i realized (thanks to some more research) that a) i couldn't really conne开发者_如何学Goct to a different server than the one that issued the page response because it'd be some sort of cross-site scripting or what not, and b) the server (Google Talk) i was trying to connect to didn't have a BOSH whatever. So. My question is sort of twofold: 1) Can i connect to a common XMPP server (say, Facebook chat or Google Talk) from a page issued by my server using javascript? (no plugins) 2) If so, how? will Strophe work? (i've heard a lot about WebSockets too, not quite sure what they are or if they'll work.) Thanks.
For purposes of connecting to various domains over HTTP protocol for data-exchange, JS is limited since POST requests are prohibited due to cross site scripting restrictions (it can be done via IFRAME tho, but for most purposes this isn't viable).
That's why you create a proxy in your preferred server-side language that connects to multiple servers and it acts as a service to which your JS "connects" and uses it to display the data to the browser.
精彩评论