Class Proxy<F, B>

Proxy messages between two ØMQ sockets. The proxy connects a front-end socket to a back-end socket. Conceptually, data flows from front-end to back-end. Depending on the socket types, replies may flow in the opposite direction. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between front-end and back-end.

// Proxy between a router/dealer socket for 5 seconds.
const proxy = new Proxy(new Router, new Dealer)
await proxy.frontEnd.bind("tcp://*:3001")
await proxy.backEnd.bind("tcp://*:3002")
setTimeout(() => proxy.terminate(), 5000)
await proxy.run()

Review the ØMQ documentation for an overview of some example applications of a proxy.

F The front-end socket type.

B The back-end socket type.

Type Parameters

Constructors

Properties

Methods

Constructors

  • Creates a new ØMQ proxy. Proxying will start between the front-end and back-end sockets when run() is called after both sockets have been bound or connected.

    Type Parameters

    Parameters

    • frontEnd: F

      The front-end socket.

    • backEnd: B

      The back-end socket.

    Returns Proxy<F, B>

Properties

backEnd: B

Returns the original back-end socket.

frontEnd: F

Returns the original front-end socket.

Methods

  • Temporarily suspends any proxy activity. Resume activity with resume().

    Returns void

  • Resumes proxy activity after suspending it with pause().

    Returns void

  • Starts the proxy loop in a worker thread and waits for its termination. Before starting, you must set any socket options, and connect or bind both front-end and back-end sockets.

    On termination the front-end and back-end sockets will be closed automatically.

    Returns Promise<void>

    Resolved when the proxy has terminated.

  • Gracefully shuts down the proxy. The front-end and back-end sockets will be closed automatically. There might be a slight delay between terminating and the run() method resolving.

    Returns void