Created
October 15, 2010 17:06
-
-
Save squaremo/628551 to your computer and use it in GitHub Desktop.
Using pub and sub message streams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var msg = require('./messages'), net = require('net'); | |
| s1 = new msg.MessageStream(net.createConnection(9000)); | |
| s1.send('pub'); | |
| s2 = new msg.MessageStream(net.createConnection(9000)); | |
| s2.send('sub'); | |
| s2.on('message', function(m) { console.log(m.toString()); }); | |
| s1.send('Hello world!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment