Update the docs with info on connection managers etc.
This commit is contained in:
parent
b35d71e22f
commit
93c0095f33
Binary file not shown.
Binary file not shown.
|
@ -7,13 +7,78 @@
|
|||
:maxdepth: 2
|
||||
|
||||
.. contents:: Table of Contents
|
||||
:depth: 2
|
||||
:depth: 3
|
||||
:local:
|
||||
|
||||
===================
|
||||
What you will need:
|
||||
===================
|
||||
|
||||
========================
|
||||
Configuration variables:
|
||||
========================
|
||||
An XMPP/Jabber server
|
||||
=====================
|
||||
|
||||
*Converse.js* implements `XMPP`_ as its messaging protocol, and therefore needs
|
||||
to connect to an XMPP/Jabber server (Jabber is really just a synonym for XMPP).
|
||||
|
||||
You can either set up your own XMPP server, or use a public one. You can find a
|
||||
list of public XMPP servers/providers on `xmpp.net`_ and a list of servers that
|
||||
you can set up yourself on `xmpp.org`_. Personally, I'm partial towards `ejabberd`_.
|
||||
|
||||
Session support (i.e. single site login)
|
||||
----------------------------------------
|
||||
|
||||
It's possible to enable single-site login, whereby users already
|
||||
authenticated in your website will also automatically be logged in on the chat server,
|
||||
but this will require custom code on your server.
|
||||
|
||||
Jack Moffitt has a great `blogpost`_ about this and even provides an `example Django application`_ to demonstrate it.
|
||||
|
||||
Connection Manager
|
||||
==================
|
||||
|
||||
Your website and *Converse.js* use `HTTP`_ as protocol to communicate with
|
||||
the webserver. HTTP connections are stateless and usually shortlived.
|
||||
|
||||
`XMPP`_ on the other hand, is the protocol that enables instant messaging, and
|
||||
its connections are stateful and usually longer.
|
||||
|
||||
To enable a web application like *Converse.js* to communicate with an XMPP
|
||||
server, we need a proxy in the middle that can act as a bridge between the two
|
||||
protocols.
|
||||
|
||||
This is the job of a connection manager. A connection manager can be either a
|
||||
standalone application or part of an XMPP server. `ejabberd`_ for example,
|
||||
includes a connection manager (but you have to enable it).
|
||||
|
||||
The demo on the `Converse.js homepage`_ uses a a connection manager located at https://bind.opkode.im.
|
||||
This connection manager is for testing purposes only, please don't use it in
|
||||
production.
|
||||
|
||||
Overcoming cross-domain request restrictions
|
||||
--------------------------------------------
|
||||
|
||||
The domain of the *Converse.js* demo is *conversejs.org*, but the domain of the connection manager is *opkode.im*.
|
||||
HTTP requests are made by *Converse.js* to the connection manager via XmlHttpRequests (XHR).
|
||||
Until recently, it was not possible to make such requests to a different domain
|
||||
than the one currently being served (to prevent XSS attacks).
|
||||
|
||||
Luckily there is now a standard called `CORS`_ (Cross-origin resource sharing), which enables exactly that.
|
||||
Modern browsers support CORS, but there are problems with Internet Explorer <
|
||||
10.
|
||||
|
||||
IE 8 and 9 partially support CORS via a proprietary implementation called
|
||||
XDomainRequest. There is a `Strophe.js plugin`_ which you can use to enable
|
||||
support for XDomainRequest when it is present.
|
||||
|
||||
In IE < 8, there is no support for CORS.
|
||||
|
||||
If you need to support these browsers, you can add a front-end proxy in
|
||||
Apache/Nginx which serves the connection manager under the same domain as your
|
||||
website. This will remove the need for any cross-domain XHR support.
|
||||
|
||||
====================================
|
||||
Converse.js Configuration variables:
|
||||
====================================
|
||||
|
||||
prebind
|
||||
========
|
||||
|
@ -72,11 +137,31 @@ auto_subscribe
|
|||
|
||||
If true, the user will automatically subscribe back to any contact requests.
|
||||
|
||||
auto_list_rooms
|
||||
===============
|
||||
|
||||
If true, and the XMPP server on which the current user is logged in supports
|
||||
multi-user chat, then a list of rooms on that server will be fetched.
|
||||
|
||||
Not recommended for servers with lots of chat rooms.
|
||||
|
||||
For each room on the server a query is made to fetch further details (e.g.
|
||||
features, number of occupants etc.), so on servers with many rooms this
|
||||
option will create lots of extra connection traffic.
|
||||
|
||||
animate
|
||||
=======
|
||||
|
||||
Show animations, for example when opening and closing chat boxes.
|
||||
|
||||
.. _`here`: http://metajack.im/2008/09/08/which-bosh-server-do-you-need/l
|
||||
|
||||
|
||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||
.. _`Converse.js homepage`: http://conversejs.org
|
||||
.. _`CORS`: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
|
||||
.. _`Strophe.js plugin`: https://gist.github.com/1095825/6b4517276f26b66b01fa97b0a78c01275fdc6ff2
|
||||
.. _`xmpp.net`: http://xmpp.net
|
||||
.. _`xmpp.org`: http://xmpp.org/xmpp-software/servers/
|
||||
.. _`ejabberd`: http://www.ejabberd.im
|
||||
.. _`blogpost`: http://metajack.im/2008/10/03/getting-attached-to-strophe
|
||||
.. _`example Django application`: https://github.com/metajack/strophejs/tree/master/examples/attach
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Configuration variables: — Converse.js 0.3 documentation</title>
|
||||
<title>What you will need: — Converse.js 0.3 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="_static/stylesheet.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
|
@ -65,21 +65,84 @@
|
|||
<div class="contents local topic" id="table-of-contents">
|
||||
<p class="topic-title first">Table of Contents</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration-variables" id="id1">Configuration variables:</a><ul>
|
||||
<li><a class="reference internal" href="#prebind" id="id2">prebind</a></li>
|
||||
<li><a class="reference internal" href="#fullname" id="id3">fullname</a></li>
|
||||
<li><a class="reference internal" href="#bosh-service-url" id="id4">bosh_service_url</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search" id="id5">xhr_user_search</a></li>
|
||||
<li><a class="reference internal" href="#auto-subscribe" id="id6">auto_subscribe</a></li>
|
||||
<li><a class="reference internal" href="#animate" id="id7">animate</a></li>
|
||||
<li><a class="reference internal" href="#what-you-will-need" id="id1">What you will need:</a><ul>
|
||||
<li><a class="reference internal" href="#an-xmpp-jabber-server" id="id2">An XMPP/Jabber server</a><ul>
|
||||
<li><a class="reference internal" href="#session-support-i-e-single-site-login" id="id3">Session support (i.e. single site login)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#connection-manager" id="id4">Connection Manager</a><ul>
|
||||
<li><a class="reference internal" href="#overcoming-cross-domain-request-restrictions" id="id5">Overcoming cross-domain request restrictions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#converse-js-configuration-variables" id="id6">Converse.js Configuration variables:</a><ul>
|
||||
<li><a class="reference internal" href="#prebind" id="id7">prebind</a></li>
|
||||
<li><a class="reference internal" href="#fullname" id="id8">fullname</a></li>
|
||||
<li><a class="reference internal" href="#bosh-service-url" id="id9">bosh_service_url</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search" id="id10">xhr_user_search</a></li>
|
||||
<li><a class="reference internal" href="#auto-subscribe" id="id11">auto_subscribe</a></li>
|
||||
<li><a class="reference internal" href="#auto-list-rooms" id="id12">auto_list_rooms</a></li>
|
||||
<li><a class="reference internal" href="#animate" id="id13">animate</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration-variables">
|
||||
<h1><a class="toc-backref" href="#id1">Configuration variables:</a><a class="headerlink" href="#configuration-variables" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="what-you-will-need">
|
||||
<h1><a class="toc-backref" href="#id1">What you will need:</a><a class="headerlink" href="#what-you-will-need" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="an-xmpp-jabber-server">
|
||||
<h2><a class="toc-backref" href="#id2">An XMPP/Jabber server</a><a class="headerlink" href="#an-xmpp-jabber-server" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>Converse.js</em> implements <a class="reference external" href="https://en.wikipedia.org/wiki/Xmpp">XMPP</a> as its messaging protocol, and therefore needs
|
||||
to connect to an XMPP/Jabber server (Jabber is really just a synonym for XMPP).</p>
|
||||
<p>You can either set up your own XMPP server, or use a public one. You can find a
|
||||
list of public XMPP servers/providers on <a class="reference external" href="http://xmpp.net">xmpp.net</a> and a list of servers that
|
||||
you can set up yourself on <a class="reference external" href="http://xmpp.org/xmpp-software/servers/">xmpp.org</a>. Personally, I’m partial towards <a class="reference external" href="http://www.ejabberd.im">ejabberd</a>.</p>
|
||||
<div class="section" id="session-support-i-e-single-site-login">
|
||||
<h3><a class="toc-backref" href="#id3">Session support (i.e. single site login)</a><a class="headerlink" href="#session-support-i-e-single-site-login" title="Permalink to this headline">¶</a></h3>
|
||||
<p>It’s possible to enable single-site login, whereby users already
|
||||
authenticated in your website will also automatically be logged in on the chat server,
|
||||
but this will require custom code on your server.</p>
|
||||
<p>Jack Moffitt has a great <a class="reference external" href="http://metajack.im/2008/10/03/getting-attached-to-strophe">blogpost</a> about this and even provides an <a class="reference external" href="https://github.com/metajack/strophejs/tree/master/examples/attach">example Django application</a> to demonstrate it.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="connection-manager">
|
||||
<h2><a class="toc-backref" href="#id4">Connection Manager</a><a class="headerlink" href="#connection-manager" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Your website and <em>Converse.js</em> use <a class="reference external" href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a> as protocol to communicate with
|
||||
the webserver. HTTP connections are stateless and usually shortlived.</p>
|
||||
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Xmpp">XMPP</a> on the other hand, is the protocol that enables instant messaging, and
|
||||
its connections are stateful and usually longer.</p>
|
||||
<p>To enable a web application like <em>Converse.js</em> to communicate with an XMPP
|
||||
server, we need a proxy in the middle that can act as a bridge between the two
|
||||
protocols.</p>
|
||||
<p>This is the job of a connection manager. A connection manager can be either a
|
||||
standalone application or part of an XMPP server. <a class="reference external" href="http://www.ejabberd.im">ejabberd</a> for example,
|
||||
includes a connection manager (but you have to enable it).</p>
|
||||
<p>The demo on the <a class="reference external" href="http://conversejs.org">Converse.js homepage</a> uses a a connection manager located at <a class="reference external" href="https://bind.opkode.im">https://bind.opkode.im</a>.
|
||||
This connection manager is for testing purposes only, please don’t use it in
|
||||
production.</p>
|
||||
<div class="section" id="overcoming-cross-domain-request-restrictions">
|
||||
<h3><a class="toc-backref" href="#id5">Overcoming cross-domain request restrictions</a><a class="headerlink" href="#overcoming-cross-domain-request-restrictions" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The domain of the <em>Converse.js</em> demo is <em>conversejs.org</em>, but the domain of the connection manager is <em>opkode.im</em>.
|
||||
HTTP requests are made by <em>Converse.js</em> to the connection manager via XmlHttpRequests (XHR).
|
||||
Until recently, it was not possible to make such requests to a different domain
|
||||
than the one currently being served (to prevent XSS attacks).</p>
|
||||
<p>Luckily there is now a standard called <a class="reference external" href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a> (Cross-origin resource sharing), which enables exactly that.
|
||||
Modern browsers support CORS, but there are problems with Internet Explorer <
|
||||
10.</p>
|
||||
<p>IE 8 and 9 partially support CORS via a proprietary implementation called
|
||||
XDomainRequest. There is a <a class="reference external" href="https://gist.github.com/1095825/6b4517276f26b66b01fa97b0a78c01275fdc6ff2">Strophe.js plugin</a> which you can use to enable
|
||||
support for XDomainRequest when it is present.</p>
|
||||
<p>In IE < 8, there is no support for CORS.</p>
|
||||
<p>If you need to support these browsers, you can add a front-end proxy in
|
||||
Apache/Nginx which serves the connection manager under the same domain as your
|
||||
website. This will remove the need for any cross-domain XHR support.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="converse-js-configuration-variables">
|
||||
<h1><a class="toc-backref" href="#id6">Converse.js Configuration variables:</a><a class="headerlink" href="#converse-js-configuration-variables" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="prebind">
|
||||
<h2><a class="toc-backref" href="#id2">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id7">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Use this option when you want to attach to an existing XMPP connection that was
|
||||
already authenticated (usually on the backend before page load).</p>
|
||||
<p>This is useful when you don’t want to render the login form on the chat control
|
||||
|
@ -99,18 +162,18 @@ have to write a Javascript snippet to attach to the set up connection:</p>
|
|||
RID (Request ID), which you use when you attach to the connection.</p>
|
||||
</div>
|
||||
<div class="section" id="fullname">
|
||||
<h2><a class="toc-backref" href="#id3">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id8">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If you are using prebinding, you need to specify the fullname of the currently
|
||||
logged in user.</p>
|
||||
</div>
|
||||
<div class="section" id="bosh-service-url">
|
||||
<h2><a class="toc-backref" href="#id4">bosh_service_url</a><a class="headerlink" href="#bosh-service-url" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id9">bosh_service_url</a><a class="headerlink" href="#bosh-service-url" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Connections to an XMPP server depend on a BOSH connection manager which acts as
|
||||
a middle man between HTTP and XMPP.</p>
|
||||
<p>See <a class="reference external" href="http://metajack.im/2008/09/08/which-bosh-server-do-you-need/l">here</a> for more information.</p>
|
||||
</div>
|
||||
<div class="section" id="xhr-user-search">
|
||||
<h2><a class="toc-backref" href="#id5">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id10">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline">¶</a></h2>
|
||||
<p>There are two ways to add users.</p>
|
||||
<ul class="simple">
|
||||
<li>The user inputs a valid JID (Jabber ID), and the user is added as a pending</li>
|
||||
|
@ -121,11 +184,20 @@ a middle man between HTTP and XMPP.</p>
|
|||
be used.</p>
|
||||
</div>
|
||||
<div class="section" id="auto-subscribe">
|
||||
<h2><a class="toc-backref" href="#id6">auto_subscribe</a><a class="headerlink" href="#auto-subscribe" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id11">auto_subscribe</a><a class="headerlink" href="#auto-subscribe" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If true, the user will automatically subscribe back to any contact requests.</p>
|
||||
</div>
|
||||
<div class="section" id="auto-list-rooms">
|
||||
<h2><a class="toc-backref" href="#id12">auto_list_rooms</a><a class="headerlink" href="#auto-list-rooms" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If true, and the XMPP server on which the current user is logged in supports
|
||||
multi-user chat, then a list of rooms on that server will be fetched.</p>
|
||||
<p>Not recommended for servers with lots of chat rooms.</p>
|
||||
<p>For each room on the server a query is made to fetch further details (e.g.
|
||||
features, number of occupants etc.), so on servers with many rooms this
|
||||
option will create lots of extra connection traffic.</p>
|
||||
</div>
|
||||
<div class="section" id="animate">
|
||||
<h2><a class="toc-backref" href="#id7">animate</a><a class="headerlink" href="#animate" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id13">animate</a><a class="headerlink" href="#animate" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Show animations, for example when opening and closing chat boxes.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Search.setIndex({objects:{},terms:{firstnam:0,show:0,xmpp:0,session:0,current:0,jid:0,middl:0,depend:0,configur:0,add:0,pend:0,text:0,input:0,match:0,anim:0,"return":0,mechan:0,chat:0,requir:0,enabl:0,success:0,list:0,authent:0,server:0,each:0,page:0,set:0,some:0,back:0,stroph:0,see:0,connect:0,pass:0,close:0,fullnam:0,variabl:0,jabber:0,content:0,between:0,"new":0,method:0,javascript:0,here:0,bosh:0,valid:0,box:0,convers:0,mysit:0,manag:0,act:0,login:0,com:0,first:0,load:0,render:0,lastnam:0,automat:0,alreadi:0,open:0,backend:0,log:0,wai:0,data:0,two:0,attach:0,json:0,call:0,subscrib:0,besid:0,more:0,"function":0,option:0,form:0,specifi:0,part:0,"true":0,must:0,made:0,"default":0,second:0,xhr:0,can:0,otherwis:0,control:0,have:0,onconnect:0,auto_subscrib:0,ani:0,exist:0,want:0,tabl:0,need:0,rid:0,bosh_service_url:0,prebind:0,write:0,end:0,make:0,when:0,snippet:0,also:0,contact:0,which:0,sid:0,you:0,sure:0,http:0,object:0,befor:0,user:0,xhr_user_search:0,man:0,don:0,url:0,request:0,inform:0,exampl:0,thi:0,choos:0,usual:0},objtypes:{},titles:["Configuration variables:"],objnames:{},filenames:["index"]})
|
||||
Search.setIndex({objects:{},terms:{xdomainrequest:0,code:0,protocol:0,just:0,show:0,xmpp:0,detail:0,session:0,partial:0,find:0,web:0,jid:0,middl:0,depend:0,firstnam:0,explor:0,configur:0,apach:0,add:0,pend:0,text:0,input:0,therefor:0,match:0,applic:0,anim:0,"return":0,between:0,opkod:0,nginx:0,mechan:0,jack:0,front:0,resourc:0,now:0,requir:0,like:0,xss:0,enabl:0,success:0,list:0,authent:0,"public":0,"default":0,either:0,each:0,manag:0,pleas:0,prevent:0,domain:0,set:0,some:0,back:0,stroph:0,realli:0,see:0,connect:0,pass:0,further:0,fullnam:0,server:0,variabl:0,what:0,jabber:0,content:0,state:0,overcom:0,internet:0,"new":0,net:0,method:0,ejabberd:0,proxi:0,javascript:0,onli:0,here:0,standard:0,standalon:0,job:0,bosh:0,locat:0,box:0,great:0,cor:0,instant:0,convers:0,mysit:0,via:0,conversej:0,current:0,page:0,etc:0,act:0,mani:0,login:0,com:0,other:0,first:0,load:0,own:0,render:0,extra:0,lastnam:0,number:0,automat:0,yourself:0,restrict:0,alreadi:0,org:0,auto_list_room:0,open:0,your:0,backend:0,differ:0,log:0,wai:0,commun:0,homepag:0,support:0,two:0,messag:0,custom:0,websit:0,attach:0,json:0,call:0,includ:0,lot:0,recommend:0,besid:0,recent:0,until:0,more:0,"function":0,luckili:0,option:0,form:0,blogpost:0,under:0,about:0,specifi:0,site:0,part:0,don:0,exactli:0,"true":0,than:0,present:0,must:0,serv:0,multi:0,made:0,room:0,possibl:0,provid:0,xmlhttprequest:0,remov:0,shortliv:0,second:0,xhr:0,bridg:0,can:0,otherwis:0,problem:0,toward:0,fetch:0,browser:0,control:0,featur:0,have:0,creat:0,demo:0,auto_subscrib:0,modern:0,share:0,ani:0,origin:0,proprietari:0,chat:0,tabl:0,close:0,exist:0,moffitt:0,bosh_service_url:0,occup:0,subscrib:0,write:0,end:0,want:0,inform:0,make:0,when:0,cross:0,same:0,contact:0,snippet:0,also:0,need:0,valid:0,rid:0,which:0,sid:0,test:0,you:0,purpos:0,singl:0,even:0,product:0,sure:0,http:0,webserv:0,prebind:0,object:0,hand:0,befor:0,plugin:0,queri:0,user:0,attack:0,thi:0,data:0,implement:0,demonstr:0,man:0,stateless:0,synonym:0,longer:0,url:0,bind:0,request:0,django:0,person:0,exampl:0,wherebi:0,onconnect:0,choos:0,traffic:0,xhr_user_search:0,usual:0},objtypes:{},titles:["What you will need:"],objnames:{},filenames:["index"]})
|
|
@ -7,13 +7,78 @@
|
|||
:maxdepth: 2
|
||||
|
||||
.. contents:: Table of Contents
|
||||
:depth: 2
|
||||
:depth: 3
|
||||
:local:
|
||||
|
||||
===================
|
||||
What you will need:
|
||||
===================
|
||||
|
||||
========================
|
||||
Configuration variables:
|
||||
========================
|
||||
An XMPP/Jabber server
|
||||
=====================
|
||||
|
||||
*Converse.js* implements `XMPP`_ as its messaging protocol, and therefore needs
|
||||
to connect to an XMPP/Jabber server (Jabber is really just a synonym for XMPP).
|
||||
|
||||
You can either set up your own XMPP server, or use a public one. You can find a
|
||||
list of public XMPP servers/providers on `xmpp.net`_ and a list of servers that
|
||||
you can set up yourself on `xmpp.org`_. Personally, I'm partial towards `ejabberd`_.
|
||||
|
||||
Session support (i.e. single site login)
|
||||
----------------------------------------
|
||||
|
||||
It's possible to enable single-site login, whereby users already
|
||||
authenticated in your website will also automatically be logged in on the chat server,
|
||||
but this will require custom code on your server.
|
||||
|
||||
Jack Moffitt has a great `blogpost`_ about this and even provides an `example Django application`_ to demonstrate it.
|
||||
|
||||
Connection Manager
|
||||
==================
|
||||
|
||||
Your website and *Converse.js* use `HTTP`_ as protocol to communicate with
|
||||
the webserver. HTTP connections are stateless and usually shortlived.
|
||||
|
||||
`XMPP`_ on the other hand, is the protocol that enables instant messaging, and
|
||||
its connections are stateful and usually longer.
|
||||
|
||||
To enable a web application like *Converse.js* to communicate with an XMPP
|
||||
server, we need a proxy in the middle that can act as a bridge between the two
|
||||
protocols.
|
||||
|
||||
This is the job of a connection manager. A connection manager can be either a
|
||||
standalone application or part of an XMPP server. `ejabberd`_ for example,
|
||||
includes a connection manager (but you have to enable it).
|
||||
|
||||
The demo on the `Converse.js homepage`_ uses a a connection manager located at https://bind.opkode.im.
|
||||
This connection manager is for testing purposes only, please don't use it in
|
||||
production.
|
||||
|
||||
Overcoming cross-domain request restrictions
|
||||
--------------------------------------------
|
||||
|
||||
The domain of the *Converse.js* demo is *conversejs.org*, but the domain of the connection manager is *opkode.im*.
|
||||
HTTP requests are made by *Converse.js* to the connection manager via XmlHttpRequests (XHR).
|
||||
Until recently, it was not possible to make such requests to a different domain
|
||||
than the one currently being served (to prevent XSS attacks).
|
||||
|
||||
Luckily there is now a standard called `CORS`_ (Cross-origin resource sharing), which enables exactly that.
|
||||
Modern browsers support CORS, but there are problems with Internet Explorer <
|
||||
10.
|
||||
|
||||
IE 8 and 9 partially support CORS via a proprietary implementation called
|
||||
XDomainRequest. There is a `Strophe.js plugin`_ which you can use to enable
|
||||
support for XDomainRequest when it is present.
|
||||
|
||||
In IE < 8, there is no support for CORS.
|
||||
|
||||
If you need to support these browsers, you can add a front-end proxy in
|
||||
Apache/Nginx which serves the connection manager under the same domain as your
|
||||
website. This will remove the need for any cross-domain XHR support.
|
||||
|
||||
====================================
|
||||
Converse.js Configuration variables:
|
||||
====================================
|
||||
|
||||
prebind
|
||||
========
|
||||
|
@ -90,5 +155,13 @@ animate
|
|||
Show animations, for example when opening and closing chat boxes.
|
||||
|
||||
.. _`here`: http://metajack.im/2008/09/08/which-bosh-server-do-you-need/l
|
||||
|
||||
|
||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||
.. _`Converse.js homepage`: http://conversejs.org
|
||||
.. _`CORS`: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
|
||||
.. _`Strophe.js plugin`: https://gist.github.com/1095825/6b4517276f26b66b01fa97b0a78c01275fdc6ff2
|
||||
.. _`xmpp.net`: http://xmpp.net
|
||||
.. _`xmpp.org`: http://xmpp.org/xmpp-software/servers/
|
||||
.. _`ejabberd`: http://www.ejabberd.im
|
||||
.. _`blogpost`: http://metajack.im/2008/10/03/getting-attached-to-strophe
|
||||
.. _`example Django application`: https://github.com/metajack/strophejs/tree/master/examples/attach
|
||||
|
|
Loading…
Reference in New Issue
Block a user