Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added pub/sub tests

  • Loading branch information...
commit 2cbebba8e9099a94b8a8b5fc45f098c618ee660f 1 parent c9f5a11
TJ Holowaychuk tj authored
33 test/test.socket.pub-sub.js
View
@@ -0,0 +1,33 @@
+
+var zmq = require('../')
+ , should = require('should');
+
+var pub = zmq.socket('pub')
+ , sub = zmq.socket('sub');
+
+var n = 0;
+
+sub.subscribe('');
+sub.on('message', function(msg){
+ msg.should.be.an.instanceof(Buffer);
+ switch (n++) {
+ case 0:
+ msg.toString().should.equal('foo');
+ break;
+ case 1:
+ msg.toString().should.equal('bar');
+ break;
+ case 2:
+ msg.toString().should.equal('baz');
+ sub.close();
+ pub.close();
+ break;
+ }
+});
+
+sub.bind('inproc://stuff', function(){
+ pub.connect('inproc://stuff');
+ pub.send('foo');
+ pub.send('bar');
+ pub.send('baz');
+});
0  test/test.socket.req.js → test/test.socket.req-rep.js
View
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.