Minimal ZeroMQ Bindings
Jan Dvořák <mordae@anilinux.org>
(require zmq) | package: zmq |
This module is typed and can be used from both normal and typed code.
syntax
syntax
The 'router socket can send messages to any of it’s peers, always prefixed with that particular peer’s identity part. The other two kinds 'pub and 'sub can connect to each other and allow one-way distribution of messages without the need to identify individual recipients on the sender’s side.
procedure
(socket-kind? v) → Boolean
v : Any
procedure
(socket kind #:identity identity #:subscribe subscribe #:bind bind #:connect connect #:send-queue send-queue #:receive-queue receive-queue) → Socket kind : Socket-Kind identity : (U String Bytes) subscribe : (Listof (U String Bytes)) bind : (Listof String) connect : (Listof String) send-queue : Natural receive-queue : Natural
The send-queue and receive-queue options correspond to ZeroMQ high-water marks. That is, number of packets to buffer when the peer is not available.
procedure
(socket-identity s) → Bytes
s : Socket (socket-identity s identity) → Void s : Socket identity : (U String Bytes)
Changing the identity after connections have been established (via binding or connecting) will most likely not work as desired.
When operating in the 'router mode, first part is reserved for target peer’s identity.
procedure
(socket-receive s) → (Listof Bytes)
s : Socket
When operating in the 'router mode, first part is reserved for target peer’s identity.
procedure
(socket-receive-evt s) → (Evtof (Listof Bytes))
s : Socket
procedure
(socket-bind s addr) → Void
s : Socket addr : String
procedure
(socket-connect s addr) → Void
s : Socket addr : String