Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (38 sloc) 1.182 kB
f4bf100 @flosse initial commit
authored
1 # node-xmpp-joap
2
3 Jabber Object Access Protocol
4 [XEP-0075](http://xmpp.org/extensions/xep-0075.html) library for
5 [node-xmpp](https://github.com/astro/node-xmpp).
6
7 ## Installation
8
9 With package manager [npm](http://npmjs.org/):
10
11 npm install node-xmpp-joap
70ae4d8 @flosse describe router usage
authored
12
13 ## Usage
14
15 ```coffeescript
16 xmpp = require "node-xmpp"
17 joap = require "node-xmpp-joap"
18
19 comp = new xmpp.Component
20 jid : "mycomponent"
21 password : "secret"
22 host : "127.0.0.1"
23 port : "8888"
24
b8db4bf @flosse set package version to v0.0.2
authored
25 classes = {}
26
70ae4d8 @flosse describe router usage
authored
27 router = new joap.Router comp
28
cdb058c @flosse added parser
authored
29 router.on "action", (action, clazz, instance, iq) ->
30 console.log action.type
31
32 router.on "read", (action, clazz, instance, iq) ->
70ae4d8 @flosse describe router usage
authored
33 console.log "read iq received"
34
cdb058c @flosse added parser
authored
35 router.on "edit", (action, clazz, instance, iq) ->
70ae4d8 @flosse describe router usage
authored
36 console.log "edit iq received"
50fb90f @flosse added method to send error stanzas; emit class and instance name as p…
authored
37
cdb058c @flosse added parser
authored
38 router.on "add", (action, clazz, instance, iq) ->
50fb90f @flosse added method to send error stanzas; emit class and instance name as p…
authored
39
40 console.log "add iq received"
41
b8db4bf @flosse set package version to v0.0.2
authored
42 if not classes[clazz]?
43 router.sendError "add", 404, "The class '#{clazz}' does not exist.", iq
50fb90f @flosse added method to send error stanzas; emit class and instance name as p…
authored
44
45 # ...
cdb058c @flosse added parser
authored
46
47 router.on "rpc", (action, clazz, instance, iq) ->
48 console.log "calling #{action.method} with:"
49 for param in actions.params
50 console.log param
51 ```
52
53 ## Running tests
54
55 ```shell
56 jasmine-node --coffee --color spec/
70ae4d8 @flosse describe router usage
authored
57 ```
Something went wrong with that request. Please try again.