Commit 8fc8a98ad1f30162b33c135da8ce4f8ba69879d7
1 parent
d4d7877a70
Exists in
master
simple-xmpp
Showing 3 changed files with 54 additions and 0 deletions Side-by-side Diff
.gitignore
... | ... | @@ -0,0 +1 @@ |
1 | +node_modules/ |
index.js
... | ... | @@ -0,0 +1,28 @@ |
1 | +var xmpp = require('simple-xmpp'); | |
2 | + | |
3 | +xmpp.on('online', function(data) { | |
4 | + console.log('Online'); | |
5 | + console.log(data); | |
6 | + console.log('Connected with JID: ' + data.jid.user); | |
7 | + console.log('Yes, I\'m connected!'); | |
8 | +}); | |
9 | + | |
10 | +xmpp.on('chat', function(from, message) { | |
11 | + xmpp.send(from, 'echo: ' + message); | |
12 | +}); | |
13 | + | |
14 | +xmpp.on('error', function(err) { | |
15 | + console.error(err); | |
16 | +}); | |
17 | + | |
18 | +xmpp.on('subscribe', function(from) { | |
19 | + xmpp.acceptSubscription(from); | |
20 | +}); | |
21 | + | |
22 | +xmpp.connect({ | |
23 | + jid: config.globals.jid, | |
24 | + password: config.globals.password, | |
25 | +}); | |
26 | + | |
27 | +// check for incoming subscription requests | |
28 | +xmpp.getRoster(); |
package.json
... | ... | @@ -0,0 +1,25 @@ |
1 | +{ | |
2 | + "name": "sate24-center-xmpp", | |
3 | + "version": "0.0.1", | |
4 | + "description": "ST24 XMPP Trx Center", | |
5 | + "main": "index.js", | |
6 | + "scripts": { | |
7 | + "test": "echo \"Error: no test specified\" && exit 1" | |
8 | + }, | |
9 | + "repository": { | |
10 | + "type": "git", | |
11 | + "url": "git@gitlab.kodesumber.com:reload97/sate24-center-xmpp.git" | |
12 | + }, | |
13 | + "keywords": [ | |
14 | + "st24", | |
15 | + "ppob", | |
16 | + "xmpp", | |
17 | + "reload97", | |
18 | + "r97" | |
19 | + ], | |
20 | + "author": "Adhidarma Hadiwinoto <adhisimon@gmail.com>", | |
21 | + "license": "BSD", | |
22 | + "dependencies": { | |
23 | + "simple-xmpp": "~1.0.1" | |
24 | + } | |
25 | +} |