zeromq REQ with renewed socket and Promise response
This package wraps a REQ socket from the zeromq package.
Reusing the same REQ socket for repeating requests in an async environment (Node.js) is not easy, as 0MQ requires to read the reply before sending a new one.
This package opens a new socket, sends the request, waits for the reply, closes the socket and resolves the Promise.
const log = consolelog Request = zmq = ; // minimal echo serverrep = zmq;rep; const request = port: 3000 ;request // { ok: true }
Multiple parallel requests
const log = consolelog Request = zmq = ; // minimal echo serverrep = zmq;rep; const request = port: 3000 ;Promiseall request request request request request // [ { data: 1 }, { data: 2 }, { data: 3 }, { data: 4 }, { data: 5 } ] ;