http over zmq STREAM
sockets. based on ideas from hintjens' web server.
other ideas are possible since protocol optimizations and transport design patterns of HTTP/2 standards track align well with the interface, namely:
Multiplexing of requests is achieved by having each HTTP request- response exchange associated with its own stream (Section 5). Streams are largely independent of each other, so a blocked or stalled request or response does not prevent progress on other streams. Flow control and prioritization ensure that it is possible to efficiently use multiplexed streams.
- latest zeromq v4+ on your system
- make sure zeromq.node works.
$ npm i zttp
any libzmq after v4+ will work, but the RAW sockopt for connecting router socket types might be depricated
var z = require('zttp').listen('tcp://127.0.0.1:3000');
z.route('/zmq/endpoint', function(req,res){
var response = '<!DOCTYPE html><head><meta charset="UTF-8"></head><body>'
+ '<p>Hello from zeromq.</p></body></html>' //for now just plain text html
res.send(response);
});
$ git clone https://github.com/reqshark/zttp.git && cd zttp
$ npm install
$ npm test