forked from xmppo/node-xmpp-bosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EMBEDDING.TXT
57 lines (43 loc) · 1.75 KB
/
EMBEDDING.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
+--------------------------------------------------+
| Embedding node-xmpp-bosh in your own application |
+--------------------------------------------------+
var nxb = require('node-xmpp-bosh');
var server = nxb.start({
logging: "WARN",
port: 5280,
path: /^\/http-bind(\/+)?$/
});
server.on(EVENT, HANDLER);
The 'server' variable is an object of type EventPipe. The
EventPipe API is similar to node.js' EventEmitter API except
that it allows you to pipe (and hence mutate events or stop
event propagation altogether) events from one listener to
another.
EVENT and HANDLER are defined as follows:
Raised by the BOSH server
-------------------------
01. 'stream-add' => function(stream_state)
02. 'stream-restart' => function(stream_state, stream_attrs)
03. 'stream-terminate' => function(stream_state)
04. 'response-acknowledged' => function(wrapped_response, state)
05. 'error' => function(exception)
06. 'no-client' => function(response_object)
07. 'nodes' => function([node], stream_state)
Listened to by the BOSH server
------------------------------
08. 'terminate' => function(stream_state, had_error)
09. 'stream-added' => function(stream_state)
10. 'response' => function(response, stream_state)
Raised by the WEBSOCKET server
------------------------------
01. stream-add
02. nodes
03. stream-terminate
04. stream-restart
05. error
Listened to by the WEBSOCKET server
-----------------------------------
06. stream-added => function(stream_state)
07. response => function(response, stream_state)
08. terminate => function(stream_state, had_error)
09. stream-restarted => function(stream_state, stanza)