Same idea as https://gist.github.com/2500291, with node.js. Do
$ node forkpeer.js
It'll print out its pid. Then
$ curl http://localhost:8000/
To reload it, use
| 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!'); |
Same idea as https://gist.github.com/2500291, with node.js. Do
$ node forkpeer.js
It'll print out its pid. Then
$ curl http://localhost:8000/
To reload it, use
| { | |
| "org": { | |
| "login": "rabbitmq", | |
| "gravatar_id": "d67216c2433a2f9e836e4491ff72a3ad", | |
| "avatar_url": "https://secure.gravatar.com/avatar/d67216c2433a2f9e836e4491ff72a3ad?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", | |
| "id": 96669, | |
| "url": "https://api.github.com/orgs/rabbitmq" | |
| }, | |
| "type": "PushEvent", | |
| "created_at": "2012-07-16T12:20:20Z", |
| // Actually you can hook #1 up as an event handler too, using the | |
| // promise implementation: | |
| function eventsS() { | |
| var step = function(sync) { | |
| return function(cons, nil) { | |
| sync.then(function(cell) { | |
| cons(cell.value, cell.tail); | |
| }); | |
| } |
| function Bloop() { } | |
| var bloop = new Bloop(); | |
| bloop.constructor === Bloop; // and indeed, | |
| bloop.constructor === Bloop.prototype.constructor; |
| widgetize.method(Error, Object, function(err) { | |
| return err; | |
| }); | |
| render.method(Error, Function, function(err, append) { | |
| append($('<span/>').addClass('error').text(err)); | |
| }); | |
| // A special value to represent values we're waiting for | |
| function Waiting() {} | |
| widgetize.method(Waiting, Object, function(wait) { |
| // Convert a promise-oriented API into a callback-oriented API | |
| function identity(x) { return x; } | |
| function slice(arrayish, arg1, arg2) { | |
| return Array.prototype.slice.call(arrayish, arg1, arg2); | |
| } | |
| // Makes a transformer from promise-returning functions to | |
| // callback-accepting functions. |
| var PassThrough = require('stream').PassThrough || | |
| require('readable-stream/passthrough'); | |
| var HWM = 100; | |
| var tasks = new PassThrough({objectMode: true, highWaterMark: HWM}); | |
| var conn, ch; | |
| var i = 0; |
| var Octet = rangeInt('octet', 0, 255); | |
| var ShortStr = label('shortstr', | |
| transform(function(s) { | |
| return s.substr(0, 255); | |
| }, arb.Str)); | |
| var LongStr = label('longstr', | |
| transform( | |
| function(bytes) { return new Buffer(bytes); }, |
| import pika | |
| import sys | |
| import logging | |
| logging.basicConfig(level=logging.CRITICAL) | |
| params = pika.URLParameters('amqp://guest:guest@localhost:5672/%2F') | |
| conn = pika.BlockingConnection(params) | |
| ch = conn.channel() |