Find a file
2023-09-12 06:42:30 -04:00
.github/workflows Update docs.yml 2023-05-11 15:28:39 +02:00
docs trying to add links to docs 2021-07-26 12:23:14 +02:00
examples fix --mm:orc and sendASync/receiveAsync (issue #33); add tests in tzmq related to this case 2022-03-21 15:12:16 +01:00
tests update tests 2022-03-22 13:54:29 +01:00
zmq Add generic blob functions for binary 2023-09-12 06:42:30 -04:00
.gitignore try another way of compiling examples 2021-03-18 19:05:32 +01:00
LICENSE Updated to work with ZeroMQ version 4 2014-08-30 20:25:24 +02:00
README.md Update README.md 2023-05-11 16:16:41 +02:00
zmq.nim network testing is too volatile on CI; don't execute examples 2021-07-26 16:16:42 +02:00
zmq.nimble ZConnection now behaves like a ref; removes exception in =destroy hook 2023-05-10 16:44:24 +02:00

Nim ZeroMQ wrapper

example workflow

Note: This wrapper was written and tested with ZeroMQ version 4.2.0. Older versions may not work.

ZeroMQ API Reference can be found here : http://api.zeromq.org/4-2:_start

Installation

$ nimble install zmq

Examples

Simple client/server

server

  import zmq

  var responder = zmq.listen("tcp://127.0.0.1:5555", REP)
  for i in 0..10:
    var request = receive(responder)
    echo("Received: ", request)
    send(responder, "World")
  close(responder)

client

  import zmq

  var requester = zmq.connect("tcp://127.0.0.1:5555", REQ)
  for i in 0..10:
    send(requester, "Hello")
    var reply = receive(requester)
    echo("Received: ", reply)
  close(requester)

Advanced usage

For more examples demonstrating many functionalities and patterns that ZMQ offers, see the tests/ and examples/ folder.

The examples are commented to better understand how zmq works.