Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mordae/racket-zmq
Minimal Racket ZeroMQ Bindings
https://github.com/mordae/racket-zmq
Last synced: 2 months ago
JSON representation
Minimal Racket ZeroMQ Bindings
- Host: GitHub
- URL: https://github.com/mordae/racket-zmq
- Owner: mordae
- License: other
- Created: 2013-06-26T09:30:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-02T10:38:05.000Z (over 9 years ago)
- Last Synced: 2024-08-04T04:06:31.123Z (6 months ago)
- Language: Racket
- Size: 284 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome-racket - zmq - Minimal Racket ZeroMQ Bindings. (Messaging)
README
# Minimal Racket ZeroMQ Bindings
## Subscriber
```racket
(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
```racket
(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
```racket
(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))
```