Permalink
Browse files

add more docs

  • Loading branch information...
1 parent c5d571e commit 853c4492d1a854da6a29b0104361c08a3941288e @tj committed Oct 12, 2012
Showing with 12 additions and 3 deletions.
  1. +12 −3 Readme.md
View
15 Readme.md
@@ -100,7 +100,8 @@ var axon = require('axon')
, sock = axon.socket('sub');
sock.connect(3000);
-sock.subscribe('user:*:login');
+sock.subscribe('user:login');
+sock.subscribe('upload:*:progress');
sock.on('message', function(topic, msg){
@@ -176,7 +177,7 @@ sock.on('message', function(task, img, reply){
## PubEmitter / SubEmitter
- `PubEmitter` and `SubEmitter` are higher-level `Pub` / `Sub` sockets, using the "json" codec to behave much like node's `EventEmitter`.
+ `PubEmitter` and `SubEmitter` are higher-level `Pub` / `Sub` sockets, using the "json" codec to behave much like node's `EventEmitter`. When a `SubEmitter`'s `.on()` method is invoked, the event name is `.subscribe()`d for you.
app.js:
@@ -199,9 +200,17 @@ var axon = require('axon')
sock.bind(3000);
-sock.on('login', function(user){
+sock.on('user:login', function(user){
console.log('%s signed in', user.name);
});
+
+sock.on('user:*', function(action, user){
+ console.log('%s %s', user.name, action);
+});
+
+sock.on('*', function(event){
+ console.log(arguments);
+});
```
## Req / Rep

0 comments on commit 853c449

Please sign in to comment.