Skip to content

Commit

Permalink
Update README with example
Browse files Browse the repository at this point in the history
  • Loading branch information
legastero committed Jan 21, 2014
1 parent 9d0536b commit 7b9258b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down

0 comments on commit 7b9258b

Please sign in to comment.