How to use the zeromq.Request function in zeromq

To help you get started, we’ve selected a few zeromq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeromq / zeromq.js / examples / majordomo / index.ts View on Github external
async function request(
  service: string,
  ...req: string[]
): Promise<undefined | Buffer[]> {
  const socket = new Request({receiveTimeout: 2000})

  console.log(`requesting '${req.join(", ")}' from '${service}'`)
  await socket.send(["MDPC01", service, ...req])

  try {
    const [blank, header, ...res] = await socket.receive()
    console.log(`received '${res.join(", ")}' from '${service}'`)
    return res
  } catch (err) {
    console.log(`timeout expired waiting for '${service}'`)


Next-generation ZeroMQ bindings for Node.js

Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis