• Stars
    star
    4
  • Rank 3,304,323 (Top 66 %)
  • Language
    Racket
  • License
    Other
  • Created over 11 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal Racket ZeroMQ Bindings

Minimal Racket ZeroMQ Bindings

Subscriber

(require zmq)

(define sub
  (socket 'sub
          #:subscribe '("foo" "bar")
          #:connect '("tcp://127.0.0.1:1234")))

(for ((parts (in-producer socket-receive/list #f sub)))
  (printf "received ~s\n" parts))

Publisher

(require zmq)

(define pub
  (socket 'pub #:bind '("tcp://127.0.0.1:1234")))

(for ((i (in-producer sleep #f 1)))
  (socket-send pub "foo" "Hello World!"))

Router

(require zmq)

(define echo
  (socket 'router
          #:identity "hub"
          #:bind '("tcp://127.0.0.1:4321")))

(for ((parts (in-producer socket-receive/list #f echo)))
  (printf "received ~s\n" parts)
  (apply socket-send echo parts))