How to use the zeromq.Dealer 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 / queue / index.ts View on Github external
async function main() {
  const sender = new Dealer()
  await sender.bind("tcp://127.0.0.1:5555")

  const queue = new Queue(sender)
  queue.send("hello")
  queue.send("world!")
  queue.send(null)

  const receiver = new Dealer()
  receiver.connect("tcp://127.0.0.1:5555")

  for await (const [msg] of receiver) {
    if (msg.length === 0) {
      receiver.close()
      console.log("received: <empty message>")
    } else {
      console.log(`received: ${msg}`)
    }
  }
}
github zeromq / zeromq.js / examples / queue / index.ts View on Github external
async function main() {
  const sender = new Dealer()
  await sender.bind("tcp://127.0.0.1:5555")

  const queue = new Queue(sender)
  queue.send("hello")
  queue.send("world!")
  queue.send(null)

  const receiver = new Dealer()
  receiver.connect("tcp://127.0.0.1:5555")

  for await (const [msg] of receiver) {
    if (msg.length === 0) {
      receiver.close()
      console.log("received: <empty message>")
    } else {
      console.log(`received: ${msg}`)
github alibaba / pipcook / packages / pipcook-python-node / src / communication / communication.ts View on Github external
nodeCleanup.uninstall();
        });
      return false;
    });
    const session: Session = {
      id,
      parent_header: {},
      last_header: {
        msg_id: "init_id", 
        msg_type: "execute_request",
        username: 'pipcook',
        version: "5.0",
        session: "pipcook_session"
      },
      dealerMsg: {},
      socketDealer: new zmq.Dealer,
      socketSubscriber: new zmq.Subscriber,
      timer: null,
      ioPort: Executor.latestIoPort,
      shellPort: Executor.latestShellPort,
      kernel
    }
    Executor.latestIoPort++;
    Executor.latestShellPort++;
    Executor.sessions.push(session);

    return session;
  }

zeromq

Next-generation ZeroMQ bindings for Node.js

MIT
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis