diff --git a/docs/doctrees/index.doctree b/docs/doctrees/index.doctree index cc92611fe..e57a116ce 100644 Binary files a/docs/doctrees/index.doctree and b/docs/doctrees/index.doctree differ diff --git a/docs/html/_sources/index.txt b/docs/html/_sources/index.txt index 06fc47e7a..fb9bca615 100644 --- a/docs/html/_sources/index.txt +++ b/docs/html/_sources/index.txt @@ -17,16 +17,16 @@ Quickstart (to get a demo up and running) When you download a specific release of *Converse.js* there will be two minified files inside the zip file. -* converse.min.js -* converse.min.css +* builds/converse.min.js +* css/converse.min.css You can include these two files inside the ** element of your website via the *script* and *link* tags: :: - - + + You need to initialize Converse.js with configuration settings particular to your requirements. @@ -34,7 +34,7 @@ your requirements. Please refer to the `Configuration variables`_ section further below for info on all the available configuration settings. -To do this, put the following inline Javascript code at the +To configure Converse.js, put the following inline Javascript code at the bottom of your page (after the closing ** element). :: @@ -48,12 +48,12 @@ bottom of your page (after the closing ** element). i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported prebind: false, show_controlbox_by_default: true, - xhr_user_search: false + roster_groups: true }); }); The `index.html `_ file inside the -Converse.js repository serves as a nice usable example of this. +Converse.js repository may serve as a nice usable example. These minified files provide the same demo-like functionality as is available on the `conversejs.org `_ website. Useful for testing or demoing, but not very @@ -79,7 +79,7 @@ website, *Converse.js* is not really meant to be a "Software-as-a-service" (SaaS webchat. Instead, its goal is to provide the means for website owners to add a tightly -integrated instant messaging service to their own sites. +integrated instant messaging service to their own websites. As a website owner, you are expected to host *Converse.js* yourself, and to do some legwork to properly configure and integrate it into your site. @@ -114,8 +114,8 @@ You can find a list of public XMPP servers/providers on `xmpp.net`_ and a list o servers that you can set up yourself on `xmpp.org`_. -Connection Manager -================== +A BOSH Connection Manager +========================= Your website and *Converse.js* use `HTTP`_ as protocol to communicate with the webserver. HTTP connections are stateless and usually shortlived. @@ -127,18 +127,25 @@ 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 `index.html `_ file inside the -The demo on the `Converse.js homepage`_ uses a a connection manager located at https://bind.conversejs.org. -This connection manager is for testing purposes only, please don't use it in -production. +This is the job of a connection manager. A connection manager can be either a +standalone application or part of an XMPP server. Popular XMPP servers such as +`ejabberd `_, `prosody `_ and +`openfire `_ all include their own connection managers +(but you usually have to enable them in the configuration). + +Standalone connection managers also exist, see for example `Punjab `_. + +The demo on the `Converse.js homepage`_ uses a connection manager located at https://bind.conversejs.org. +This connection manager is available 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*. +Lets say your domain is *example.org*, but the domain of your connection +manager is *example.com*. + 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). @@ -281,67 +288,6 @@ Example code for server-side prebinding See this `example Django application`_ by Jack Moffitt. -Setting up a BOSH server ------------------------- - -The `Movim `_ project wiki has a very thorough page on setting up a BOSH server for -a wide variety of standalone or XMPP servers. - -http://wiki.movim.eu/manual:bosh_servers - -Facebook integration -==================== - -.. Note :: - It should be possible to integrate Converse.js with Facebook chat, and - below I'll provide some tips and documentation on how to achieve this. That - said, I don't have a Facebook account and therefore haven't tried to do - this myself. Feedback and patches from people who have succesfully done this - will be appreciated. - -Converse.js uses `Strophe.js `_ to connect and -communicate with the XMPP server. One nice thing about Strophe.js is that it -can be extended via `plugins `_. - -Here is a `plugin for authenticating with facebook -`_. - -You will need your own BOSH connection manager to act as a proxy between -Converse.js/Strophe.js and Facebook's XMPP server. That is because Facebook's -XMPP server doesn't support BOSH natively. - -The BOSH connection manager that I make available for -testing purposes (at https://bind.conversejs.org) uses `Punjab `_, -although there are quite a few other options available as well. - -When you configure Converse.js, via its ``initialize`` method, you must specify the -`bosh_service_url`_ value, which is to be your BOSH connection manager. - -Please note, to enable Facebook integration, you'll have to -get your hands dirty and modify Converse.js's code, so that it calls the -``facebookConnect`` method of the plugin above. - -The plugin above gives the following code example for you to meditate upon: - -:: - - connection = new Strophe.Connection("http://localhost:5280/bosh"); - connection.facebookConnect( - "12345@chat.facebook.com", - onConnectFacebook, - 300, - 1, - '5e64a30272af065bd72258c565a03f2f', - '8147a27e4a7f9b55ffc85c2683f9529a', - FB.getSession().session_key - ); - -The connection is already created inside Converse.js, so the -``facebookConnect`` method needs to also be called from there. - -If someone submits a sane patch that does the above, I'll be happy to merge it. -Until then, people will have to do this themselves. - ======== Features ======== @@ -375,6 +321,25 @@ For now, suffice to say that although its useful to have OTR support in Converse.js in order to avoid most eavesdroppers, if you need serious communications privacy, then you're much better off using native software. +Sound Notifications +=================== + +From version 0.8.1 Converse.js can play a sound notification when you receive a +message. + +For more info, please see the `play_sounds`_ configuration setting. + +Multilingual Support +==================== + +Converse.js is translated into multiple languages. The default build, +``converse.min.js``, includes all languages. + +Languages increase the size of the Converse.js significantly. + +If you only need one, or a subset of the available languages, it's better to +make a custom build which includes only those languages that you need. + =========== Development =========== @@ -982,6 +947,21 @@ i18n Specify the locale/language. The language must be in the ``locales`` object. Refer to ``./locale/locales.js`` to see which locales are supported. +play_sounds +----------- + +Default: ``false`` + +Inside the ``./sounds`` directory of the Converse.js repo, you'll see MP3 and Ogg +formatted sound files. We need both, because neither format is supported by all browsers. + +For now, sound files are looked up by convention, not configuration. So to have +a sound play when a message is received, make sure that your webserver serves +it in both formats as ``http://yoursite.com/sounds/msg_received.mp3`` and +``http://yoursite.com/sounds/msg_received.ogg``. + +``http://yoursite.com`` should of course be your site's URL. + prebind -------- diff --git a/docs/html/index.html b/docs/html/index.html index 3e92dc8f3..631683c09 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -57,87 +57,88 @@

Table of Contents

-

Quickstart (to get a demo up and running)

+

Quickstart (to get a demo up and running)

When you download a specific release of Converse.js there will be two minified files inside the zip file.

    -
  • converse.min.js
  • -
  • converse.min.css
  • +
  • builds/converse.min.js
  • +
  • css/converse.min.css

You can include these two files inside the <head> element of your website via the script and link tags:

-
<link rel="stylesheet" type="text/css" media="screen" href="converse.min.css">
-<script src="converse.min.js"></script>
+
<link rel="stylesheet" type="text/css" media="screen" href="css/converse.min.css">
+<script src="builds/converse.min.js"></script>
 

You need to initialize Converse.js with configuration settings particular to your requirements.

Please refer to the Configuration variables section further below for info on all the available configuration settings.

-

To do this, put the following inline Javascript code at the +

To configure Converse.js, put the following inline Javascript code at the bottom of your page (after the closing </body> element).

require(['converse'], function (converse) {
     converse.initialize({
@@ -172,13 +173,13 @@ bottom of your page (after the closing </body> element).

i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported prebind: false, show_controlbox_by_default: true, - xhr_user_search: false + roster_groups: true }); });

The index.html file inside the -Converse.js repository serves as a nice usable example of this.

+Converse.js repository may serve as a nice usable example.

These minified files provide the same demo-like functionality as is available on the conversejs.org website. Useful for testing or demoing, but not very practical.

@@ -191,12 +192,12 @@ the minified Javascript file. Read -

Introduction

+

Introduction

Even though you can connect to public XMPP servers on the conversejs.org website, Converse.js is not really meant to be a “Software-as-a-service” (SaaS) webchat.

Instead, its goal is to provide the means for website owners to add a tightly -integrated instant messaging service to their own sites.

+integrated instant messaging service to their own websites.

As a website owner, you are expected to host Converse.js yourself, and to do some legwork to properly configure and integrate it into your site.

The benefit in doing this, is that your users have a much more streamlined and integrated @@ -210,9 +211,9 @@ code.

requirements.

-

What you will need

+

What you will need

-

An XMPP/Jabber server

+

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 connect to public XMPP servers like jabber.org but if you want to @@ -220,8 +221,8 @@ have Session Support y

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.

-
-

Connection Manager

+
+

A BOSH 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 @@ -229,16 +230,20 @@ 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.

+

The index.html file inside the

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.conversejs.org. -This connection manager is for testing purposes only, please don’t use it in -production.

+standalone application or part of an XMPP server. Popular XMPP servers such as +ejabberd, prosody and +openfire all include their own connection managers +(but you usually have to enable them in the configuration).

+

Standalone connection managers also exist, see for example Punjab.

+

The demo on the Converse.js homepage uses a connection manager located at https://bind.conversejs.org. +This connection manager is available 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). +

Overcoming cross-domain request restrictions

+

Lets say your domain is example.org, but the domain of your connection +manager is example.com.

+

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. @@ -287,9 +292,9 @@ the cross-domain restriction is m

-

Server-side authentication

+

Server-side authentication

-

Prebinding and Single Session Support

+

Prebinding and Single Session Support

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,

This session should also persist across page loads. In other words, we don’t @@ -347,7 +352,7 @@ Additionally you need to pass in valid jid, sid

-

Example code for server-side prebinding

+

Example code for server-side prebinding

  • PHP:
    @@ -364,55 +369,6 @@ Michael Weibel and the folks from Candy chat.

-
-

Setting up a BOSH server

-

The Movim project wiki has a very thorough page on setting up a BOSH server for -a wide variety of standalone or XMPP servers.

-

http://wiki.movim.eu/manual:bosh_servers

-
-
-
-

Facebook integration

-
-

Note

-

It should be possible to integrate Converse.js with Facebook chat, and -below I’ll provide some tips and documentation on how to achieve this. That -said, I don’t have a Facebook account and therefore haven’t tried to do -this myself. Feedback and patches from people who have succesfully done this -will be appreciated.

-
-

Converse.js uses Strophe.js to connect and -communicate with the XMPP server. One nice thing about Strophe.js is that it -can be extended via plugins.

-

Here is a plugin for authenticating with facebook.

-

You will need your own BOSH connection manager to act as a proxy between -Converse.js/Strophe.js and Facebook’s XMPP server. That is because Facebook’s -XMPP server doesn’t support BOSH natively.

-

The BOSH connection manager that I make available for -testing purposes (at https://bind.conversejs.org) uses Punjab, -although there are quite a few other options available as well.

-

When you configure Converse.js, via its initialize method, you must specify the -bosh_service_url value, which is to be your BOSH connection manager.

-

Please note, to enable Facebook integration, you’ll have to -get your hands dirty and modify Converse.js’s code, so that it calls the -facebookConnect method of the plugin above.

-

The plugin above gives the following code example for you to meditate upon:

-
connection = new Strophe.Connection("http://localhost:5280/bosh");
-connection.facebookConnect(
-    "12345@chat.facebook.com",
-    onConnectFacebook,
-    300,
-    1,
-    '5e64a30272af065bd72258c565a03f2f',
-    '8147a27e4a7f9b55ffc85c2683f9529a',
-    FB.getSession().session_key
-);
-
-
-

The connection is already created inside Converse.js, so the -facebookConnect method needs to also be called from there.

-

If someone submits a sane patch that does the above, I’ll be happy to merge it. -Until then, people will have to do this themselves.

@@ -439,15 +395,29 @@ secure crypto.

Converse.js in order to avoid most eavesdroppers, if you need serious communications privacy, then you’re much better off using native software.

+
+

Sound Notifications

+

From version 0.8.1 Converse.js can play a sound notification when you receive a +message.

+

For more info, please see the play_sounds configuration setting.

+
+
+

Multilingual Support

+

Converse.js is translated into multiple languages. The default build, +converse.min.js, includes all languages.

+

Languages increase the size of the Converse.js significantly.

+

If you only need one, or a subset of the available languages, it’s better to +make a custom build which includes only those languages that you need.

+
-

Development

+

Development

If you want to work with the non-minified Javascript and CSS files you’ll soon notice that there are references to a missing components folder. Please follow the instructions below to create this folder and fetch Converse’s 3rd-party dependencies.

-

Install the development and front-end dependencies

+

Install the development and front-end dependencies

We use development tools (Grunt and Bower) which depend on Node.js and npm (the Node package manager).

If you don’t have Node.js installed, you can download and install the latest @@ -486,7 +456,7 @@ Converse.js directly depends and which will be loaded in the browser.

-

Without AMD and require.js

+

Without AMD and require.js

Converse.js can also be used without require.js. If you for some reason prefer to use it this way, please refer to non_amd.html @@ -508,9 +478,9 @@ for an example of how and in what order all the Javascript files that converse.j depends on need to be loaded.

-

Before submitting a pull request

+

Before submitting a pull request

-

Add tests for your bugfix or feature

+

Add tests for your bugfix or feature

Add a test for any bug fixed or feature added. We use Jasmine for testing.

Take a look at tests.html and spec/MainSpec.js to see how @@ -519,7 +489,7 @@ the tests are implemented.

contact me and I’ll be happy to help.

-

Check that the tests pass

+

Check that the tests pass

Check that the Jasmine tests complete sucessfully. Open tests.html in your browser, and the tests will run automatically.

@@ -529,7 +499,7 @@ in your browser, and the tests will run automatically.

-

Check your code for errors or bad habits by running JSHint

+

Check your code for errors or bad habits by running JSHint

JSHint will do a static analysis of your code and hightlight potential errors and/or bad habits.

grunt jshint
@@ -542,9 +512,9 @@ and/or bad habits.

-

Minification

+

Minification

-

Minifying Javascript and CSS

+

Minifying Javascript and CSS

Please make sure to read the section Development and that you have installed all development dependencies (long story short, you can run npm install and then grunt fetch).

@@ -562,7 +532,7 @@ using alm
-

Translations

+

Translations

Note

Translations take up a lot of space and will bloat your minified file. @@ -645,11 +615,11 @@ those hoops you had to jump through.

-

Troubleshooting

+

Troubleshooting

-

Conflicts with other Javascript libraries

+

Conflicts with other Javascript libraries

-

Problem:

+

Problem:

You are using other Javascript libraries (like JQuery plugins), and get errors like these in your browser console:

Uncaught TypeError: Object [object Object] has no method 'xxx' from example.js
@@ -657,7 +627,7 @@ get errors like these in your browser console:

-

Solution:

+

Solution:

First, find out which object is referred to by Object [object Object].

It will probably be the jQuery object $ or perhaps the underscore.js object _.

For the purpose of demonstration, I’m going to assume its $, but the same @@ -699,11 +669,11 @@ jQuery plugins must load after jQuery).

-

Events

+

Events

Converse.js emits events to which you can subscribe from your own Javascript.

Concerning events, the following methods are available:

-

Event Methods

+

Event Methods

  • on(eventName, callback):

    @@ -749,7 +719,7 @@ exactly once.

-

Event Types

+

Event Types

Here are the different events that are emitted:

@@ -833,7 +803,7 @@ exactly once.

-

Configuration

+

Configuration

The included minified JS and CSS files can be used for demoing or testing, but you’ll want to configure Converse.js to suit your needs before you deploy it on your website.

@@ -847,9 +817,9 @@ all the available configuration settings.

JS file so that it will include the new settings. Please refer to the Minification section for more info on how to do this.

-

Configuration variables

+

Configuration variables

-

allow_contact_requests

+

allow_contact_requests

Default: true

Allow users to add one another as contacts. If this is set to false, the Add a contact widget, Contact Requests and Pending Contacts roster @@ -857,23 +827,23 @@ sections will all not appear. Additionally, all incoming contact requests will b ignored.

-

allow_muc

+

allow_muc

Default: true

Allow multi-user chat (muc) in chatrooms. Setting this to false will remove the Chatrooms tab from the control box.

-
-

allow_muc

+
+

allow_muc

Default: true

Allow Off-the-record encryption of single-user chat messages.

-

animate

+

animate

Default: true

Show animations, for example when opening and closing chat boxes.

-

auto_list_rooms

+

auto_list_rooms

Default: false

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.

@@ -883,24 +853,24 @@ features, number of occupants etc.), so on servers with many rooms this option will create lots of extra connection traffic.

-

auto_reconnect

+

auto_reconnect

Default: true

Automatically reconnect to the XMPP server if the connection drops unexpectedly.

-

auto_subscribe

+

auto_subscribe

Default: false

If true, the user will automatically subscribe back to any contact requests.

-

bosh_service_url

+

bosh_service_url

Connections to an XMPP server depend on a BOSH connection manager which acts as a middle man between HTTP and XMPP.

See here for more information.

-

cache_otr_key

+

cache_otr_key

Default: false

Let the OTR (Off-the-record encryption) private key be cached in your browser’s session storage.

@@ -919,17 +889,17 @@ current session. Previous sessions however cannot be decrypted.

-

debug

+

debug

Default: false

If set to true, debugging output will be logged to the browser console.

-

expose_rid_and_sid

+

expose_rid_and_sid

Default: false

Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed globally via the API. This allows other scripts served on the same page to use @@ -938,7 +908,7 @@ these values.

and inject fake chat messages.

-

forward_messages

+

forward_messages

Default: false

If set to true, sent messages will also be forwarded to other connected XMPP resources (e.g. chat clients) of the same user.

@@ -947,24 +917,35 @@ browser and you want sent messages to appear in all of them.

See also XEP 0297: Stanza Forwarding

-

fullname

+

fullname

If you are using prebinding, can specify the fullname of the currently logged in user, otherwise the user’s vCard will be fetched.

-

hide_muc_server

+

hide_muc_server

Default: false

Hide the server input field of the form inside the Room panel of the controlbox. Useful if you want to restrict users to a specific XMPP server of your choosing.

-

i18n

+

i18n

Specify the locale/language. The language must be in the locales object. Refer to ./locale/locales.js to see which locales are supported.

+
+

play_sounds

+

Default: false

+

Inside the ./sounds directory of the Converse.js repo, you’ll see MP3 and Ogg +formatted sound files. We need both, because neither format is supported by all browsers.

+

For now, sound files are looked up by convention, not configuration. So to have +a sound play when a message is received, make sure that your webserver serves +it in both formats as http://yoursite.com/sounds/msg_received.mp3 and +http://yoursite.com/sounds/msg_received.ogg.

+

http://yoursite.com should of course be your site’s URL.

+
-

prebind

+

prebind

Default: false

Use this option when you want to attach to an existing XMPP connection that was already authenticated (usually on the backend before page load).

@@ -977,7 +958,7 @@ values as jid, Additionally, you have to specify bosh_service_url.

-

roster_groups

+

roster_groups

Default: false

If set to true, converse.js will show any roster groups you might have configured.

@@ -989,7 +970,7 @@ elsewhere.

-

show_controlbox_by_default

+

show_controlbox_by_default

Default: false

The “controlbox” refers to the special chatbox containing your contacts roster, status widget, chatrooms and other controls.

@@ -999,13 +980,13 @@ the page with class toggle-controlbox.

page load.

-

show_only_online_users

+

show_only_online_users

Default: false

If set to true, only online users will be shown in the contacts roster. Users with any other status (e.g. away, busy etc.) will not be shown.

-

storage

+

storage

Default: session

Valid options: session, local.

This option determines the type of storage @@ -1018,20 +999,20 @@ it’s closed, the data is cleared.

Data in localStorage on the other hand is kept indefinitely.

-

use_otr_by_default

+

use_otr_by_default

Default: false

If set to true, Converse.js will automatically try to initiate an OTR (off-the-record) encrypted chat session every time you open a chat box.

-

use_vcards

+

use_vcards

Default: true

Determines whether the XMPP server will be queried for roster contacts’ VCards or not. VCards contain extra personal information such as your fullname and avatar image.

-

visible_toolbar_buttons

+

visible_toolbar_buttons

Default:

{
     'emoticons': true,
@@ -1071,7 +1052,7 @@ When the call button is pressed, it will emit an event that can be used by a thi
 
 
-

xhr_custom_status

+

xhr_custom_status

Default: false

Note

@@ -1081,7 +1062,7 @@ When the call button is pressed, it will emit an event that can be used by a thi remote server.

-

xhr_custom_status_url

+

xhr_custom_status_url

Note

XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).

@@ -1093,7 +1074,7 @@ message will be made.

The message itself is sent in the request under the key msg.