Permalink
Browse files

misc

  • Loading branch information...
1 parent 193ab91 commit 2b7baaca6596499ba2acb1dc4561e891f563cd66 @tj tj committed Mar 14, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 examples/http/app.js
View
@@ -6,7 +6,7 @@ var zmq = require('../../')
var server = http.createServer(function(req, res){
req.on('data', function(chunk){
- res.write(chunk);
+ res.write(chunk.toString().toUpperCase());
}).on('end', function(){
res.end();
});
@@ -25,6 +25,15 @@ sock.on('message', function(envelope, id, type, data){
req = new Stream;
res = new Stream;
res.socket = req;
+
+ res.write = function(data){
+ sock.send([envelope, id, 'data', data]);
+ };
+
+ res.end = function(){
+ sock.send([envelope, id, 'end']);
+ };
+
socks[id] = req;
data = JSON.parse(data.toString());
req.url = data.url;

0 comments on commit 2b7baac

Please sign in to comment.