Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (30 sloc) 3.454 kb
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
1 # XMPP/HTTP PubSub Demo
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
2
3 A simple demo of Publish/Subscribe in the browser using Strophe.js
4
0c931ec Duncan Robertson README changes for user accounts
whomwah authored
5 This consists of a client.html and a publisher.html and a working XMPP setup (see below). You will be able to go to the publisher.html and send HTML and txt messages. Any number of people who have connected to client.html will recieved these messages and display them on their screen. This demo is not meant for production use, and serves to get people up and running with the technology as quickly as possible.
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
6
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
7 ## Browser Support
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
8
fe3f84e Duncan Robertson tweak README and test why my gravatar is not displaying correctly
whomwah authored
9 You need a modern browser for the [CORS](http://www.w3.org/TR/cors/) support. This code has been tested in:
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
10
11 * Google Chrome
12 * Safari 4+
13 * Firefox 3.5+
14
15 If you find it works in any other browsers, do let us know.
16
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
17 ## Strophe
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
18
3ef354e Duncan Robertson update to README
whomwah authored
19 This demo uses the wonderful Strophe.js by [Jack Moffitt](http://metajack.im/) to do all the clever stuff.
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
20
ca07edd Duncan Robertson tweak readme
whomwah authored
21 * [strophe.js](https://github.com/metajack/strophejs)
22 * [strophe.pubsub.js](https://github.com/metajack/strophejs)
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
23
3ef354e Duncan Robertson update to README
whomwah authored
24 minimized versions of both are included, but for the latest versions and more information, visit the links above.
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
25
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
26 ## Setting up an XMPP server
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
27
d09c672 Ramon Rovirosa Update README.md
ramonrovirosa authored
28 You'll need a running [XMPP server](http://xmpp.org/xmpp-software/servers/) and [BOSH connection manager](http://metajack.im/2008/09/08/which-bosh-server-do-you-need/). There are many options out there, but I've choosen to help you install [Ejabberd](http://www.ejabberd.im/), a popular XMPP server and latest versions (2.1.3+) comes with BOSH (Bidirectional-streams Over Synchronous HTTP) and CORS (Cross-Origin Resource Sharing) support baked in and enabled by default.
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
29
3ef354e Duncan Robertson update to README
whomwah authored
30 I have added installation instructions for Ejabberd on Centos 5.5 in the /docs directory. If you have similar instructions for other setups, please send [pull requests](http://help.github.com/pull-requests/), and I'll try and feed these back.
1f3bf21 Duncan Robertson add strophe demo
whomwah authored
31
d09c672 Ramon Rovirosa Update README.md
ramonrovirosa authored
32 Make sure to config Ejabberd to work with anonymous connections by modifying your ejabberd.cfg file by adding under the Authentication section this line:
33 ```{host_config, "vm.local", [{auth_method, [anonymous]},
34 {anonymous_protocol, both}]}. ```
35 (You'll then need to restart Ejabberd)
36
89ca52c Ramon Rovirosa Update README.md
ramonrovirosa authored
37 #####Note on Openfire#####
38 Openfire does not allow anonymous pubsub messaging.
39
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
40 ## Setting up the client and publisher
bf2701d Duncan Robertson updtae README
whomwah authored
41
3126b19 Duncan Robertson update instructions
whomwah authored
42 Once you have your XMPP server installed, you need to stick all the files above into a directory you can browse to in a web browser. You'll then need to update the configuration settings to reflect you XMPP server. It's also worth noting that all the files are currently grouped together, so if you are testing this on a public server, you'd want to stick all the publisher stuff behind some authentication, so anyone can't come along and start publishing stuff.
43
44 The files you'll need to update are:
45
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
46 * [js/shared.js](https://github.com/bbcrd/Strophejs-PubSub-Demo/blob/master/js/shared.js)
3126b19 Duncan Robertson update instructions
whomwah authored
47
48 This contains the BOSH_SERVICE and XMPP_SERVER locations. You will likely just have to change the domain. You can also change the PUBSUB_NODE. This is the common location that both publisher and clients go for messages. The dots just create a namespace. Always start the name with pubsub.
49
83dcd85 Duncan Robertson Applied Apache 2.0 license
whomwah authored
50 * [js/publisher.js](https://github.com/bbcrd/Strophejs-PubSub-Demo/blob/master/js/publisher.js)
3126b19 Duncan Robertson update instructions
whomwah authored
51
0c931ec Duncan Robertson README changes for user accounts
whomwah authored
52 At the top of this page you set the account you will be logging in as, to publish the messages to all the connected clients. You can just use the admin account you created when setting up Ejabberd.
Something went wrong with that request. Please try again.