Skip to content
Browse files

Update README with example

  • Loading branch information...
1 parent 9d0536b commit 7b9258b676c5dae7297a43661b8885fd0640db26 @legastero legastero committed
Showing with 25 additions and 0 deletions.
  1. +25 −0 README.md
View
25 README.md
@@ -36,6 +36,31 @@ The bundled and minified files will be in the generated `build` directory.
If you want to see stanza.io in action in a full-featured client, take a look at [Otalk.im](http://otalk.im) (and its [source](https://github.com/andyet/otalk)).
+## Echo Client Demo
+
+```javascript
+var XMPP = require('stanza.io'); // if using browserify
+
+var client = XMPP.createClient({
+ jid: 'echobot@example.com',
+ password: 'hunter2'
+});
+
+client.on('session:started', function () {
+ client.getRoster();
+ client.sendPresence();
+});
+
+client.on('chat', function (msg) {
+ client.sendMessage({
+ to: msg.from,
+ body: 'You sent: ' + msg.body
+ });
+});
+
+client.connect();
+```
+
## License
MIT

0 comments on commit 7b9258b

Please sign in to comment.
Something went wrong with that request. Please try again.