Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:visionmedia/axon

  • Loading branch information...
commit a543b79d6f4adb0f3db93c4b51079a6cde8d0ea0 2 parents ddf300c + ce128e6
@tj authored
Showing with 14 additions and 12 deletions.
  1. +6 −5 examples/reqrep/rep.js
  2. +8 −7 examples/reqrep/req.js
View
11 examples/reqrep/rep.js
@@ -1,10 +1,11 @@
var axon = require('../..')
- , sock = axon.socket('rep');
+ , rep = axon.socket('rep');
-sock.bind(3000);
+rep.format('json');
+rep.bind(3000);
-sock.on('message', function(msg, reply){
- console.log('got: %s', msg.toString());
- reply('pong');
+rep.on('message', function(msg, reply){
+ console.log('requested: %j', msg);
+ reply({ goodbye: 'world' });
});
View
15 examples/reqrep/req.js
@@ -1,11 +1,12 @@
var axon = require('../..')
- , sock = axon.socket('req');
+ , req = axon.socket('req');
-sock.connect(3000);
+req.format('json');
+req.connect(3000);
-sock.on('message', function(msg){
- console.log('got: %s', msg.toString());
-});
-
-sock.send('ping');
+setInterval(function(){
+ req.send({ hello: 'world' }, function(msg){
+ console.log('replied: %j', msg);
+ });
+}, 150);
Please sign in to comment.
Something went wrong with that request. Please try again.