9.0
top
← prev up next →

Minimal ZeroMQ BindingsπŸ”— i

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

Socket

Type of a ZeroMQ socket of any kind.

syntax

Socket-Kind

Type of a ZeroMQ socket kind, equivalent to (U 'router'pub'sub).

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? v)Boolean

v:Any
Predicate for Socket .

procedure

( socket-kind? v)Boolean

v:Any
Predicate for Socket-Kind .

procedure

( socket kind
#:identityidentity
#:subscribesubscribe
#:bindbind
#:connectconnect
#:send-queuesend-queue
#:receive-queuereceive-queue)Socket
identity:(U String Bytes )
subscribe:(Listof (U String Bytes ))
bind:(Listof String )
connect:(Listof String )
send-queue:Natural
receive-queue:Natural
Create new socket of specified kind and optionally immediately bind and/or connect it, using defined identity.

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 sidentity)Void
s:Socket
identity:(U String Bytes )
Determine or change socket identity.

Changing the identity after connections have been established (via binding or connecting) will most likely not work as desired.

procedure

( socket-send spart...)Void

s:Socket
part:(U Bytes String )
Send a multi-part message.

When operating in the 'router mode, first part is reserved for target peer’s identity.

procedure

( socket-receive s)(Listof Bytes )

s:Socket
Receive a multi-part message as a list of it’s parts.

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
Returns an asynchronous event that produces received lists. Results are identical to return values of socket-receive .

procedure

( socket-bind saddr)Void

s:Socket
addr:String
Bind to specified ZeroMQ endpoint address such as "tcp://127.0.0.1:1234".

procedure

( socket-connect saddr)Void

s:Socket
addr:String
Connect to specified ZeroMQ endpoint address such as "tcp://127.0.0.1:1234".

procedure

( socket-subscribe sprefix)Void

s:Socket
prefix:(U String Bytes )
Used with 'sub sockets to define prefix of messages to receive from a peer 'pub socket.

procedure

( socket-unsubscribe sprefix)Void

s:Socket
prefix:(U String Bytes )
Cancel subscription made with socket-subscribe .

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /