README.markdown

Sun, 21 Feb 2010 15:25:11 -0800

author
zuwiki <zuwiki@gmail.com>
date
Sun, 21 Feb 2010 15:25:11 -0800
changeset 14
aaad945d10ba
parent 11
080d81e07112
child 18
06abd01c13cb
permissions
-rw-r--r--

Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.

10
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 # xmpp.js
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 ## Server-side XMPP in Javascript
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 [xmpp.js](http://xmppjs.prosody.im/) is a library for [Node.js](http://nodejs.org/) that allows
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 you to connect to an XMPP server as a component.
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 For those already familiar with the client-side [Strophe.js](http://code.stanziq.com/strophe/)
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 library then there is almost nothing to learn - the API is almost exactly the same. The only
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 difference is that this time you can run your code on the server, and handle XMPP traffic from
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 clients on behalf of a whole domain. It's like writing an XMPP server but with the hard parts
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 handled for you.
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 xmpp.js works with any [XEP-0114](http://www.xmpp.org/extensions/xep-0114.html)-compliant server
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 (that's practically all of them), so you need not worry about your code being tied in to a
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 particular server implementation.
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 ### How it works at the XMPP level
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 XMPP components "bind" to a domain, usually a subdomain of the main XMPP service, such as
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 pubsub.example.org, or conference.example.org. All incoming stanzas addressed to that domain
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 (to='service.example.org') or to entities on that domain (to='user@service.example.org') will be
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 routed to your xmpp.js-based code.
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 For outgoing stanzas your component is in full control. You can specify any 'from' address on
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 your stanzas, many servers don't even enforce that the originating domain of the stanza is the
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 component's domain, allowing you to send stanzas on behalf of any user on the server.
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 ### Getting started
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28 Firstly, you'll need Node installed if you haven't it already, this is fairly straightforward -
11
080d81e07112 README.markdown: Add the missing URLs
Matthew Wild <mwild1@gmail.com>
parents: 10
diff changeset
29 [instructions are here](http://nodejs.org/#build).
10
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30
11
080d81e07112 README.markdown: Add the missing URLs
Matthew Wild <mwild1@gmail.com>
parents: 10
diff changeset
31 Check out the source xmpp.js code, from either the
080d81e07112 README.markdown: Add the missing URLs
Matthew Wild <mwild1@gmail.com>
parents: 10
diff changeset
32 [Mercurial repository](http://code.matthewwild.co.uk/xmppjs/) or
080d81e07112 README.markdown: Add the missing URLs
Matthew Wild <mwild1@gmail.com>
parents: 10
diff changeset
33 [Github project](http://github.com/mwild1/xmppjs).
10
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 In the examples directory you will find an example component which echoes messages it receives
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36 back to the sender. If you have a local [Prosody](http://prosody.im/) server installed then you
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 can simply add these lines to your Prosody config to make this example work:
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 Component "echo.localhost"
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 component_secret = "hellohello"
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 Ater restarting Prosody try running:
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 node examples/echo.js
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
45
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46 Log into your Prosody with a client and send a message to anything@echo.localhost - you should
543c2018896c Add README.markdown
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 receive an instant response back - congratulations!

mercurial