zeromq4-haskell-0.8.0: Bindings to ZeroMQ 4.x

Copyright | (c) 2010-2013 Toralf Wittner
License | MIT
Maintainer | Toralf Wittner <tw@dtex.org>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell98

System.ZMQ4

Contents

- Type Definitions
  - Socket Types
  - Socket type-classes
  - Various type definitions
- General Operations
- Context Options (Read)
- Context Options (Write)
- Socket Options (Read)
- Socket Options (Write)
- Restrictions
- Error Handling
- Low-level Functions
- Utils

Description

0MQ haskell binding. The API closely follows the C-API of 0MQ with the main difference being that sockets are typed.

Notes

Many option settings use a `Restriction` to further constrain the range of possible values of their integral types. For example the maximum message size can be given as -1, which means no limit or by greater values, which denote the message size in bytes. The type of `setMaxMessageSize` is therefore:

    setMaxMessageSize :: Integral i
                        => Restricted (Nneg1, Int64) i
                        -> Socket a
                        -> IO ()

which means any integral value in the range of `-1` to (`maxBound :: Int64`) can be given. To create a restricted value from plain value, use `toRestricted` or `restrict`.

Synopsis

- data Pair = Pair
- data Pub = Pub
- data Sub = Sub
- data XPub = XPub
- data XSub = XSub
- data Req = Req
- data Rep = Rep
- data Dealer = Dealer
- data Router = Router
- type XReq = Dealer
- type XRep = Router
- data Pull = Pull
- data Push = Push
- data Stream = Stream
- class SocketType a
- class Sender a
- class Receiver a
- class Subscriber a
- class SocketLike s
- class Conflatable a
- class SendProbe a
- type Size = Word
- data Context
- data Socket a
- data Flag
  - = DontWait
  - | SendMore
- data Switch
  - = Default
  - | On
  - | Off
- type Timeout = Int64
- data Event
  - = In
  - | Out
  - | Err
- data EventType
  - = ConnectedEvent
  - | ConnectDelayedEvent
  - | ConnectRetriedEvent
  - | ListeningEvent
  - | BindFailedEvent
  - | AcceptedEvent
  - | AcceptFailedEvent
  - | ClosedEvent
  - | CloseFailedEvent
  - | DisconnectedEvent
  - | MonitorStoppedEvent
  - | AllEvents
- data EventMsg
  - = Connected !ByteString !Fd
  - | ConnectDelayed !ByteString
  - | ConnectRetried !ByteString !Int
  - | Listening !ByteString !Fd
  - | BindFailed !ByteString !Int
  - | Accepted !ByteString !Fd
  - | AcceptFailed !ByteString !Int
  - | Closed !ByteString !Fd
  - | CloseFailed !ByteString !Int
  - | Disconnected !ByteString !Fd
  - | MonitorStopped !ByteString !Int
- data Poll s m where
  - Sock :: s t -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m
  - File :: Fd -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m
- data KeyFormat a where
  - BinaryFormat :: KeyFormat Div4
  - TextFormat :: KeyFormat Div5
- data SecurityMechanism
  - = Null
  - | Plain
  - | Curve
- withContext :: (Context -> IO a) -> IO a
- withSocket :: SocketType a => Context -> a -> (Socket a -> IO b) -> IO b
- bind :: Socket a -> String -> IO ()
- unbind :: Socket a -> String -> IO ()
- connect :: Socket a -> String -> IO ()
- disconnect :: Socket a -> String -> IO ()
- send :: Sender a => Socket a -> [Flag] -> ByteString -> IO ()
- send' :: Sender a => Socket a -> [Flag] -> ByteString -> IO ()
- sendMulti :: Sender a => Socket a -> NonEmpty ByteString -> IO ()
- receive :: Receiver a => Socket a -> IO ByteString
- receiveMulti :: Receiver a => Socket a -> IO [ByteString]
- version :: IO (Int, Int, Int)
- monitor :: [EventType] -> Context -> Socket a -> IO (Bool -> IO (Maybe EventMsg))
- socketMonitor :: [EventType] -> String -> Socket a -> IO ()
- poll :: (SocketLike s, MonadIO m) => Timeout -> [Poll s m] -> m [[Event]]
- subscribe :: Subscriber a => Socket a -> ByteString -> IO ()
- unsubscribe :: Subscriber a => Socket a -> ByteString -> IO ()
- ioThreads :: Context -> IO Word
- maxSockets :: Context -> IO Word
- setIoThreads :: Word -> Context -> IO ()
- setMaxSockets :: Word -> Context -> IO ()
- affinity :: Socket a -> IO Word64
- backlog :: Socket a -> IO Int
- conflate :: Conflatable a => Socket a -> IO Bool
- curvePublicKey :: KeyFormat f -> Socket a -> IO ByteString
- curveSecretKey :: KeyFormat f -> Socket a -> IO ByteString
- curveServerKey :: KeyFormat f -> Socket a -> IO ByteString
- delayAttachOnConnect :: Socket a -> IO Bool
- events :: Socket a -> IO [Event]
- fileDescriptor :: Socket a -> IO Fd
- identity :: Socket a -> IO ByteString
- immediate :: Socket a -> IO Bool
- ipv4Only :: Socket a -> IO Bool
- ipv6 :: Socket a -> IO Bool
- lastEndpoint :: Socket a -> IO String
- linger :: Socket a -> IO Int
- maxMessageSize :: Socket a -> IO Int64
- mcastHops :: Socket a -> IO Int
- mechanism :: Socket a -> IO SecurityMechanism
- moreToReceive :: Socket a -> IO Bool
- plainServer :: Socket a -> IO Bool
- plainPassword :: Socket a -> IO ByteString
- plainUserName :: Socket a -> IO ByteString
- rate :: Socket a -> IO Int
- receiveBuffer :: Socket a -> IO Int
- receiveHighWM :: Socket a -> IO Int
- receiveTimeout :: Socket a -> IO Int
- reconnectInterval :: Socket a -> IO Int
- reconnectIntervalMax :: Socket a -> IO Int
- recoveryInterval :: Socket a -> IO Int
- sendBuffer :: Socket a -> IO Int
- sendHighWM :: Socket a -> IO Int
- sendTimeout :: Socket a -> IO Int
- tcpKeepAlive :: Socket a -> IO Switch
- tcpKeepAliveCount :: Socket a -> IO Int
- tcpKeepAliveIdle :: Socket a -> IO Int
- tcpKeepAliveInterval :: Socket a -> IO Int
- zapDomain :: Socket a -> IO ByteString
- setAffinity :: Word64 -> Socket a -> IO ()
- setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setConflate :: Conflatable a => Bool -> Socket a -> IO ()
- setCurveServer :: Bool -> Socket a -> IO ()
- setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setDelayAttachOnConnect :: Bool -> Socket a -> IO ()
- setIdentity :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setImmediate :: Bool -> Socket a -> IO ()
- setIpv4Only :: Bool -> Socket a -> IO ()
- setIpv6 :: Bool -> Socket a -> IO ()
- setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket a -> IO ()
- setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO ()
- setPlainServer :: Bool -> Socket a -> IO ()
- setPlainPassword :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setPlainUserName :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setProbeRouter :: SendProbe a => Bool -> Socket a -> IO ()
- setRate :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO ()
- setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReqCorrelate :: Bool -> Socket Req -> IO ()
- setReqRelaxed :: Bool -> Socket Req -> IO ()
- setRouterMandatory :: Bool -> Socket Router -> IO ()
- setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpAcceptFilter :: Maybe ByteString -> Socket a -> IO ()
- setTcpKeepAlive :: Switch -> Socket a -> IO ()
- setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setXPubVerbose :: Bool -> Socket XPub -> IO ()
- setZapDomain :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- restrict :: Restriction r v => v -> Restricted r v
- toRestricted :: Restriction r v => v -> Maybe (Restricted r v)
- data ZMQError
- errno :: ZMQError -> Int
- source :: ZMQError -> String
- message :: ZMQError -> String
- init :: Size -> IO Context
- term :: Context -> IO ()
- shutdown :: Context -> IO ()
- context :: IO Context
- socket :: SocketType a => Context -> a -> IO (Socket a)
- close :: Socket a -> IO ()
- waitRead :: Socket a -> IO ()
- waitWrite :: Socket a -> IO ()
- z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString
- z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString
- proxy :: Socket a -> Socket b -> Maybe (Socket c) -> IO ()
- curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString)

# Type Definitions

## Socket Types

data Pair #

ZMQ_PAIR

Constructors

Pair |

Instances

Eq Pair # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pair -> Pair -> Bool # (/=) :: Pair -> Pair -> Bool #
Generic Pair # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Pair :: * -> * # Methods from :: Pair -> Rep Pair x # to :: Rep Pair x -> Pair #
SocketType Pair # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pair -> ZMQSocketType #
Receiver Pair # |
Instance details Defined in System.ZMQ4
Sender Pair # |
Instance details Defined in System.ZMQ4
type Rep Pair # |
Instance details Defined in System.ZMQ4 type Rep Pair = D1 (MetaData "Pair" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Pair" PrefixI False) (U1 :: * -> *))

data Pub #

ZMQ_PUB

Constructors

Pub |

Instances

Eq Pub # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pub -> Pub -> Bool # (/=) :: Pub -> Pub -> Bool #
Generic Pub # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Pub :: * -> * # Methods from :: Pub -> Rep Pub x # to :: Rep Pub x -> Pub #
SocketType Pub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pub -> ZMQSocketType #
Conflatable Pub # |
Instance details Defined in System.ZMQ4
Sender Pub # |
Instance details Defined in System.ZMQ4
type Rep Pub # |
Instance details Defined in System.ZMQ4 type Rep Pub = D1 (MetaData "Pub" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Pub" PrefixI False) (U1 :: * -> *))

data Sub #

ZMQ_SUB

Constructors

Sub |

Instances

Eq Sub # |
Instance details Defined in System.ZMQ4 Methods (==) :: Sub -> Sub -> Bool # (/=) :: Sub -> Sub -> Bool #
Generic Sub # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Sub :: * -> * # Methods from :: Sub -> Rep Sub x # to :: Rep Sub x -> Sub #
SocketType Sub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Sub -> ZMQSocketType #
Conflatable Sub # |
Instance details Defined in System.ZMQ4
Receiver Sub # |
Instance details Defined in System.ZMQ4
Subscriber Sub # |
Instance details Defined in System.ZMQ4
type Rep Sub # |
Instance details Defined in System.ZMQ4 type Rep Sub = D1 (MetaData "Sub" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Sub" PrefixI False) (U1 :: * -> *))

data XPub #

ZMQ_XPUB

Constructors

XPub |

Instances

Eq XPub # |
Instance details Defined in System.ZMQ4 Methods (==) :: XPub -> XPub -> Bool # (/=) :: XPub -> XPub -> Bool #
Generic XPub # |
Instance details Defined in System.ZMQ4 Associated Types type Rep XPub :: * -> * # Methods from :: XPub -> Rep XPub x # to :: Rep XPub x -> XPub #
SocketType XPub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XPub -> ZMQSocketType #
Receiver XPub # |
Instance details Defined in System.ZMQ4
Sender XPub # |
Instance details Defined in System.ZMQ4
type Rep XPub # |
Instance details Defined in System.ZMQ4 type Rep XPub = D1 (MetaData "XPub" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "XPub" PrefixI False) (U1 :: * -> *))

data XSub #

ZMQ_XSUB

Constructors

XSub |

Instances

Eq XSub # |
Instance details Defined in System.ZMQ4 Methods (==) :: XSub -> XSub -> Bool # (/=) :: XSub -> XSub -> Bool #
Generic XSub # |
Instance details Defined in System.ZMQ4 Associated Types type Rep XSub :: * -> * # Methods from :: XSub -> Rep XSub x # to :: Rep XSub x -> XSub #
SocketType XSub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XSub -> ZMQSocketType #
Receiver XSub # |
Instance details Defined in System.ZMQ4
Sender XSub # |
Instance details Defined in System.ZMQ4
type Rep XSub # |
Instance details Defined in System.ZMQ4 type Rep XSub = D1 (MetaData "XSub" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "XSub" PrefixI False) (U1 :: * -> *))

data Req #

ZMQ_REQ

Constructors

Req |

Instances

Eq Req # |
Instance details Defined in System.ZMQ4 Methods (==) :: Req -> Req -> Bool # (/=) :: Req -> Req -> Bool #
Generic Req # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Req :: * -> * # Methods from :: Req -> Rep Req x # to :: Rep Req x -> Req #
SocketType Req # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Req -> ZMQSocketType #
SendProbe Req # |
Instance details Defined in System.ZMQ4
Receiver Req # |
Instance details Defined in System.ZMQ4
Sender Req # |
Instance details Defined in System.ZMQ4
type Rep Req # |
Instance details Defined in System.ZMQ4 type Rep Req = D1 (MetaData "Req" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Req" PrefixI False) (U1 :: * -> *))

data Rep #

ZMQ_REP

Constructors

Rep |

Instances

Eq Rep # |
Instance details Defined in System.ZMQ4 Methods (==) :: Rep -> Rep -> Bool # (/=) :: Rep -> Rep -> Bool #
Generic Rep # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Rep :: * -> * # Methods from :: Rep -> Rep0 Rep x # to :: Rep0 Rep x -> Rep #
SocketType Rep # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Rep -> ZMQSocketType #
Receiver Rep # |
Instance details Defined in System.ZMQ4
Sender Rep # |
Instance details Defined in System.ZMQ4
type Rep Rep # |
Instance details Defined in System.ZMQ4 type Rep Rep = D1 (MetaData "Rep" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Rep" PrefixI False) (U1 :: * -> *))

data Dealer #

ZMQ_DEALER

Constructors

Dealer |

Instances

Eq Dealer # |
Instance details Defined in System.ZMQ4 Methods (==) :: Dealer -> Dealer -> Bool # (/=) :: Dealer -> Dealer -> Bool #
Generic Dealer # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Dealer :: * -> * # Methods from :: Dealer -> Rep Dealer x # to :: Rep Dealer x -> Dealer #
SocketType Dealer # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Dealer -> ZMQSocketType #
SendProbe Dealer # |
Instance details Defined in System.ZMQ4
Conflatable Dealer # |
Instance details Defined in System.ZMQ4
Receiver Dealer # |
Instance details Defined in System.ZMQ4
Sender Dealer # |
Instance details Defined in System.ZMQ4
type Rep Dealer # |
Instance details Defined in System.ZMQ4 type Rep Dealer = D1 (MetaData "Dealer" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Dealer" PrefixI False) (U1 :: * -> *))

data Router #

ZMQ_ROUTER

Constructors

Router |

Instances

Eq Router # |
Instance details Defined in System.ZMQ4 Methods (==) :: Router -> Router -> Bool # (/=) :: Router -> Router -> Bool #
Generic Router # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Router :: * -> * # Methods from :: Router -> Rep Router x # to :: Rep Router x -> Router #
SocketType Router # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Router -> ZMQSocketType #
SendProbe Router # |
Instance details Defined in System.ZMQ4
Receiver Router # |
Instance details Defined in System.ZMQ4
Sender Router # |
Instance details Defined in System.ZMQ4
type Rep Router # |
Instance details Defined in System.ZMQ4 type Rep Router = D1 (MetaData "Router" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Router" PrefixI False) (U1 :: * -> *))

type XReq = Dealer #

Deprecated: Use Dealer

type XRep = Router #

Deprecated: Use Router

data Pull #

ZMQ_PULL

Constructors

Pull |

Instances

Eq Pull # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pull -> Pull -> Bool # (/=) :: Pull -> Pull -> Bool #
Generic Pull # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Pull :: * -> * # Methods from :: Pull -> Rep Pull x # to :: Rep Pull x -> Pull #
SocketType Pull # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pull -> ZMQSocketType #
Conflatable Pull # |
Instance details Defined in System.ZMQ4
Receiver Pull # |
Instance details Defined in System.ZMQ4
type Rep Pull # |
Instance details Defined in System.ZMQ4 type Rep Pull = D1 (MetaData "Pull" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Pull" PrefixI False) (U1 :: * -> *))

data Push #

ZMQ_PUSH

Constructors

Push |

Instances

Eq Push # |
Instance details Defined in System.ZMQ4 Methods (==) :: Push -> Push -> Bool # (/=) :: Push -> Push -> Bool #
Generic Push # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Push :: * -> * # Methods from :: Push -> Rep Push x # to :: Rep Push x -> Push #
SocketType Push # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Push -> ZMQSocketType #
Conflatable Push # |
Instance details Defined in System.ZMQ4
Sender Push # |
Instance details Defined in System.ZMQ4
type Rep Push # |
Instance details Defined in System.ZMQ4 type Rep Push = D1 (MetaData "Push" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Push" PrefixI False) (U1 :: * -> *))

data Stream #

ZMQ_STREAM

Constructors

Stream |

Instances

Eq Stream # |
Instance details Defined in System.ZMQ4 Methods (==) :: Stream -> Stream -> Bool # (/=) :: Stream -> Stream -> Bool #
Generic Stream # |
Instance details Defined in System.ZMQ4 Associated Types type Rep Stream :: * -> * # Methods from :: Stream -> Rep Stream x # to :: Rep Stream x -> Stream #
SocketType Stream # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Stream -> ZMQSocketType #
Receiver Stream # |
Instance details Defined in System.ZMQ4
Sender Stream # |
Instance details Defined in System.ZMQ4
type Rep Stream # |
Instance details Defined in System.ZMQ4 type Rep Stream = D1 (MetaData "Stream" "System.ZMQ4" "zeromq4-haskell-0.8.0-HhCj2pXaHIhEYYU3EDu02c" False) (C1 (MetaCons "Stream" PrefixI False) (U1 :: * -> *))

## Socket type-classes

class SocketType a #

Socket types.

Minimal complete definition

zmqSocketType

Instances

SocketType Stream # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Stream -> ZMQSocketType #
SocketType Push # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Push -> ZMQSocketType #
SocketType Pull # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pull -> ZMQSocketType #
SocketType Router # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Router -> ZMQSocketType #
SocketType Dealer # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Dealer -> ZMQSocketType #
SocketType Rep # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Rep -> ZMQSocketType #
SocketType Req # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Req -> ZMQSocketType #
SocketType XSub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XSub -> ZMQSocketType #
SocketType XPub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XPub -> ZMQSocketType #
SocketType Sub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Sub -> ZMQSocketType #
SocketType Pub # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pub -> ZMQSocketType #
SocketType Pair # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pair -> ZMQSocketType #

class Sender a #

Sockets which can `send`.

Instances

Sender Stream # |
Instance details Defined in System.ZMQ4
Sender Push # |
Instance details Defined in System.ZMQ4
Sender Router # |
Instance details Defined in System.ZMQ4
Sender Dealer # |
Instance details Defined in System.ZMQ4
Sender Rep # |
Instance details Defined in System.ZMQ4
Sender Req # |
Instance details Defined in System.ZMQ4
Sender XSub # |
Instance details Defined in System.ZMQ4
Sender XPub # |
Instance details Defined in System.ZMQ4
Sender Pub # |
Instance details Defined in System.ZMQ4
Sender Pair # |
Instance details Defined in System.ZMQ4

class Receiver a #

Sockets which can `receive`.

Instances

Receiver Stream # |
Instance details Defined in System.ZMQ4
Receiver Pull # |
Instance details Defined in System.ZMQ4
Receiver Router # |
Instance details Defined in System.ZMQ4
Receiver Dealer # |
Instance details Defined in System.ZMQ4
Receiver Rep # |
Instance details Defined in System.ZMQ4
Receiver Req # |
Instance details Defined in System.ZMQ4
Receiver XSub # |
Instance details Defined in System.ZMQ4
Receiver XPub # |
Instance details Defined in System.ZMQ4
Receiver Sub # |
Instance details Defined in System.ZMQ4
Receiver Pair # |
Instance details Defined in System.ZMQ4

class Subscriber a #

Sockets which can `subscribe`.

Instances

Subscriber Sub # |
Instance details Defined in System.ZMQ4

class SocketLike s #

Minimal complete definition

toSocket

Instances

SocketLike Socket # |
Instance details Defined in System.ZMQ4.Internal Methods toSocket :: Socket t -> Socket t #
SocketLike (Socket z) # |
Instance details Defined in System.ZMQ4.Monadic Methods toSocket :: Socket z t -> Socket0 t #

class Conflatable a #

Sockets which can be `conflate`d.

Instances

Conflatable Push # |
Instance details Defined in System.ZMQ4
Conflatable Pull # |
Instance details Defined in System.ZMQ4
Conflatable Dealer # |
Instance details Defined in System.ZMQ4
Conflatable Sub # |
Instance details Defined in System.ZMQ4
Conflatable Pub # |
Instance details Defined in System.ZMQ4

class SendProbe a #

Sockets which can send probes (cf. `setProbeRouter`).

Instances

SendProbe Router # |
Instance details Defined in System.ZMQ4
SendProbe Dealer # |
Instance details Defined in System.ZMQ4
SendProbe Req # |
Instance details Defined in System.ZMQ4

## Various type definitions

type Size = Word #

data Context #

A 0MQ context representation.

data Socket a #

A 0MQ Socket.

Instances

SocketLike Socket # |
Instance details Defined in System.ZMQ4.Internal Methods toSocket :: Socket t -> Socket t #

data Flag #

Flags to apply on send operations (cf. man zmq_send)

Constructors

DontWait | ZMQ_DONTWAIT (Only relevant on Windows.)
SendMore | ZMQ_SNDMORE

Instances

Eq Flag # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: Flag -> Flag -> Bool # (/=) :: Flag -> Flag -> Bool #
Ord Flag # |
Instance details Defined in System.ZMQ4.Internal Methods compare :: Flag -> Flag -> Ordering # (<) :: Flag -> Flag -> Bool # (<=) :: Flag -> Flag -> Bool # (>) :: Flag -> Flag -> Bool # (>=) :: Flag -> Flag -> Bool # max :: Flag -> Flag -> Flag # min :: Flag -> Flag -> Flag #
Show Flag # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> Flag -> ShowS # show :: Flag -> String # showList :: [Flag] -> ShowS #

data Switch #

Configuration switch

Constructors

Default | Use default setting
On | Activate setting
Off | De-activate setting

Instances

Eq Switch # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: Switch -> Switch -> Bool # (/=) :: Switch -> Switch -> Bool #
Ord Switch # |
Instance details Defined in System.ZMQ4.Internal Methods compare :: Switch -> Switch -> Ordering # (<) :: Switch -> Switch -> Bool # (<=) :: Switch -> Switch -> Bool # (>) :: Switch -> Switch -> Bool # (>=) :: Switch -> Switch -> Bool # max :: Switch -> Switch -> Switch # min :: Switch -> Switch -> Switch #
Show Switch # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> Switch -> ShowS # show :: Switch -> String # showList :: [Switch] -> ShowS #

type Timeout = Int64 #

data Event #

Socket events.

Constructors

In | `ZMQ_POLLIN` (incoming messages)
Out | `ZMQ_POLLOUT` (outgoing messages, i.e. at least 1 byte can be written)
Err |
    ZMQ_POLLERR

Instances

Eq Event # |
Instance details Defined in System.ZMQ4 Methods (==) :: Event -> Event -> Bool # (/=) :: Event -> Event -> Bool #
Ord Event # |
Instance details Defined in System.ZMQ4 Methods compare :: Event -> Event -> Ordering # (<) :: Event -> Event -> Bool # (<=) :: Event -> Event -> Bool # (>) :: Event -> Event -> Bool # (>=) :: Event -> Event -> Bool # max :: Event -> Event -> Event # min :: Event -> Event -> Event #
Read Event # |
Instance details Defined in System.ZMQ4 Methods readsPrec :: Int -> ReadS Event # readList :: ReadS [Event] # readPrec :: ReadPrec Event # readListPrec :: ReadPrec [Event] #
Show Event # |
Instance details Defined in System.ZMQ4 Methods showsPrec :: Int -> Event -> ShowS # show :: Event -> String # showList :: [Event] -> ShowS #

data EventType #

Event types to monitor.

Constructors

ConnectedEvent |
ConnectDelayedEvent |
ConnectRetriedEvent |
ListeningEvent |
BindFailedEvent |
AcceptedEvent |
AcceptFailedEvent |
ClosedEvent |
CloseFailedEvent |
DisconnectedEvent |
MonitorStoppedEvent |
AllEvents |

Instances

Eq EventType # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: EventType -> EventType -> Bool # (/=) :: EventType -> EventType -> Bool #
Ord EventType # |
Instance details Defined in System.ZMQ4.Internal Methods compare :: EventType -> EventType -> Ordering # (<) :: EventType -> EventType -> Bool # (<=) :: EventType -> EventType -> Bool # (>) :: EventType -> EventType -> Bool # (>=) :: EventType -> EventType -> Bool # max :: EventType -> EventType -> EventType # min :: EventType -> EventType -> EventType #
Show EventType # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> EventType -> ShowS # show :: EventType -> String # showList :: [EventType] -> ShowS #

data EventMsg #

Event Message to receive when monitoring socket events.

Constructors

Connected !ByteString !Fd |
ConnectDelayed !ByteString |
ConnectRetried !ByteString !Int |
Listening !ByteString !Fd |
BindFailed !ByteString !Int |
Accepted !ByteString !Fd |
AcceptFailed !ByteString !Int |
Closed !ByteString !Fd |
CloseFailed !ByteString !Int |
Disconnected !ByteString !Fd |
MonitorStopped !ByteString !Int |

Instances

Eq EventMsg # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: EventMsg -> EventMsg -> Bool # (/=) :: EventMsg -> EventMsg -> Bool #
Show EventMsg # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> EventMsg -> ShowS # show :: EventMsg -> String # showList :: [EventMsg] -> ShowS #

data Poll s m where #

A `Poll` value contains the object to poll (a 0MQ socket or a file descriptor), the set of `Event`s which are of interest and--optionally-- a callback-function which is invoked iff the set of interested events overlaps with the actual events.

Constructors

Sock :: s t -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m |
File :: Fd -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m |

data KeyFormat a where #

Constructors

BinaryFormat :: KeyFormat Div4 |
TextFormat :: KeyFormat Div5 |

Instances

Eq (KeyFormat a) # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: KeyFormat a -> KeyFormat a -> Bool # (/=) :: KeyFormat a -> KeyFormat a -> Bool #
Show (KeyFormat a) # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> KeyFormat a -> ShowS # show :: KeyFormat a -> String # showList :: [KeyFormat a] -> ShowS #

data SecurityMechanism #

Constructors

Null |
Plain |
Curve |

Instances

Eq SecurityMechanism # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: SecurityMechanism -> SecurityMechanism -> Bool # (/=) :: SecurityMechanism -> SecurityMechanism -> Bool #
Show SecurityMechanism # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> SecurityMechanism -> ShowS # show :: SecurityMechanism -> String # showList :: [SecurityMechanism] -> ShowS #

# General Operations

withContext :: (Context -> IO a) -> IO a #

Run an action with a 0MQ context. The `Context` supplied to your action will not be valid after the action either returns or throws an exception.

withSocket :: SocketType a => Context -> a -> (Socket a -> IO b) -> IO b #

Run an action with a 0MQ socket. The socket will be closed after running the supplied action even if an error occurs. The socket supplied to your action will not be valid after the action terminates.

bind :: Socket a -> String -> IO () #

Bind the socket to the given address (cf. zmq_bind).

unbind :: Socket a -> String -> IO () #

Unbind the socket from the given address (cf. zmq_unbind).

connect :: Socket a -> String -> IO () #

Connect the socket to the given address (cf. zmq_connect).

disconnect :: Socket a -> String -> IO () #

Disconnect the socket from the given endpoint (cf. zmq_disconnect).

send :: Sender a => Socket a -> [Flag] -> ByteString -> IO () #

Send the given `ByteString` over the socket (cf. zmq_sendmsg).

Note: This function always calls `zmq_sendmsg` in a non-blocking way, i.e. there is no need to provide the `ZMQ_DONTWAIT` flag as this is used by default. Still `send` is blocking the thread as long as the message can not be queued on the socket using GHC's `threadWaitWrite`.

send' :: Sender a => Socket a -> [Flag] -> ByteString -> IO () #

Send the given `ByteString` over the socket (cf. zmq_sendmsg).

This is operationally identical to `send socket (Strict.concat (Lazy.toChunks lbs)) flags` but may be more efficient.

Note: This function always calls `zmq_sendmsg` in a non-blocking way, i.e. there is no need to provide the `ZMQ_DONTWAIT` flag as this is used by default. Still `send'` is blocking the thread as long as the message can not be queued on the socket using GHC's `threadWaitWrite`.

sendMulti :: Sender a => Socket a -> NonEmpty ByteString -> IO () #

Send a multi-part message. This function applies the `SendMore` `Flag` between all message parts. 0MQ guarantees atomic delivery of a multi-part message (cf. zmq_sendmsg).

receive :: Receiver a => Socket a -> IO ByteString #

Receive a `ByteString` from socket (cf. zmq_recvmsg).

Note: This function always calls `zmq_recvmsg` in a non-blocking way, i.e. there is no need to provide the `ZMQ_DONTWAIT` flag as this is used by default. Still `receive` is blocking the thread as long as no data is available using GHC's `threadWaitRead`.

receiveMulti :: Receiver a => Socket a -> IO [ByteString] #

Receive a multi-part message. This function collects all message parts send via `sendMulti`.

version :: IO (Int, Int, Int) #

Return the runtime version of the underlying 0MQ library as a (major, minor, patch) triple.

monitor :: [EventType] -> Context -> Socket a -> IO (Bool -> IO (Maybe EventMsg)) #

Monitor socket events (cf. zmq_socket_monitor).

This function returns a function which can be invoked to retrieve the next socket event, potentially blocking until the next one becomes available. When applied to `False`, monitoring will terminate, i.e. internal monitoring resources will be disposed. Consequently after `monitor` has been invoked, the returned function must be applied once to `False`.

socketMonitor :: [EventType] -> String -> Socket a -> IO () #

Setup socket monitoring, i.e. a `Pair` socket which sends monitoring events about the given `Socket` to the given address.

poll :: (SocketLike s, MonadIO m) => Timeout -> [Poll s m] -> m [[Event]] #

Polls for events on the given `Poll` descriptors. Returns a list of events per descriptor which have occured. (cf. zmq_poll)

subscribe :: Subscriber a => Socket a -> ByteString -> IO () #

Subscribe Socket to given subscription.

unsubscribe :: Subscriber a => Socket a -> ByteString -> IO () #

Unsubscribe Socket from given subscription.

# Context Options (Read)

ioThreads :: Context -> IO Word #

zmq_ctx_get ZMQ_IO_THREADS.

maxSockets :: Context -> IO Word #

zmq_ctx_get ZMQ_MAX_SOCKETS.

# Context Options (Write)

setIoThreads :: Word -> Context -> IO () #

zmq_ctx_get ZMQ_IO_THREADS.

setMaxSockets :: Word -> Context -> IO () #

zmq_ctx_get ZMQ_MAX_SOCKETS.

# Socket Options (Read)

affinity :: Socket a -> IO Word64 #

zmq_getsockopt ZMQ_AFFINITY.

backlog :: Socket a -> IO Int #

zmq_getsockopt ZMQ_BACKLOG.

conflate :: Conflatable a => Socket a -> IO Bool #

Restricts the outgoing and incoming socket buffers to a single message.

curvePublicKey :: KeyFormat f -> Socket a -> IO ByteString #

zmq_getsockopt ZMQ_CURVE_PUBLICKEY.

curveSecretKey :: KeyFormat f -> Socket a -> IO ByteString #

zmq_getsockopt ZMQ_CURVE_SECRETKEY.

curveServerKey :: KeyFormat f -> Socket a -> IO ByteString #

zmq_getsockopt ZMQ_CURVE_SERVERKEY.

delayAttachOnConnect :: Socket a -> IO Bool #

Deprecated: Use immediate

events :: Socket a -> IO [Event] #

zmq_getsockopt ZMQ_EVENTS.

fileDescriptor :: Socket a -> IO Fd #

zmq_getsockopt ZMQ_FD.

identity :: Socket a -> IO ByteString #

zmq_getsockopt ZMQ_IDENTITY.

immediate :: Socket a -> IO Bool #

zmq_getsockopt ZMQ_IMMEDIATE.

ipv4Only :: Socket a -> IO Bool #

Deprecated: Use ipv6

ipv6 :: Socket a -> IO Bool #

zmq_getsockopt ZMQ_IPV6.

lastEndpoint :: Socket a -> IO String #

zmq_getsockopt ZMQ_LAST_ENDPOINT.

linger :: Socket a -> IO Int #

zmq_getsockopt ZMQ_LINGER.

maxMessageSize :: Socket a -> IO Int64 #

zmq_getsockopt ZMQ_MAXMSGSIZE.

mcastHops :: Socket a -> IO Int #

zmq_getsockopt ZMQ_MULTICAST_HOPS.

mechanism :: Socket a -> IO SecurityMechanism #

zmq_getsockopt ZMQ_MECHANISM.

moreToReceive :: Socket a -> IO Bool #

zmq_getsockopt ZMQ_RCVMORE.

plainServer :: Socket a -> IO Bool #

zmq_getsockopt ZMQ_PLAIN_SERVER.

plainPassword :: Socket a -> IO ByteString #

zmq_getsockopt ZMQ_PLAIN_PASSWORD.

plainUserName :: Socket a -> IO ByteString #

zmq_getsockopt ZMQ_PLAIN_USERNAME.

rate :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RATE.

receiveBuffer :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RCVBUF.

receiveHighWM :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RCVHWM.

receiveTimeout :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RCVTIMEO.

reconnectInterval :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RECONNECT_IVL.

reconnectIntervalMax :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RECONNECT_IVL_MAX.

recoveryInterval :: Socket a -> IO Int #

zmq_getsockopt ZMQ_RECOVERY_IVL.

sendBuffer :: Socket a -> IO Int #

zmq_getsockopt ZMQ_SNDBUF.

sendHighWM :: Socket a -> IO Int #

zmq_getsockopt ZMQ_SNDHWM.

sendTimeout :: Socket a -> IO Int #

zmq_getsockopt ZMQ_SNDTIMEO.

tcpKeepAlive :: Socket a -> IO Switch #

zmq_getsockopt ZMQ_TCP_KEEPALIVE.

tcpKeepAliveCount :: Socket a -> IO Int #

zmq_getsockopt ZMQ_TCP_KEEPALIVE_CNT.

tcpKeepAliveIdle :: Socket a -> IO Int #

zmq_getsockopt ZMQ_TCP_KEEPALIVE_IDLE.

tcpKeepAliveInterval :: Socket a -> IO Int #

zmq_getsockopt ZMQ_TCP_KEEPALIVE_INTVL.

zapDomain :: Socket a -> IO ByteString #

zmq_getsockopt ZMQ_ZAP_DOMAIN.

# Socket Options (Write)

setAffinity :: Word64 -> Socket a -> IO () #

zmq_setsockopt ZMQ_AFFINITY.

setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_BACKLOG.

setConflate :: Conflatable a => Bool -> Socket a -> IO () #

Restrict the outgoing and incoming socket buffers to a single message.

setCurveServer :: Bool -> Socket a -> IO () #

zmq_setsockopt ZMQ_CURVE_SERVER.

setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_CURVE_PUBLICKEY.

setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_CURVE_SECRETKEY.

setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_CURVE_SERVERKEY.

setDelayAttachOnConnect :: Bool -> Socket a -> IO () #

Deprecated: Use setImmediate

setIdentity :: Restricted (N1, N254) ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_IDENTITY.

setImmediate :: Bool -> Socket a -> IO () #

zmq_setsockopt ZMQ_IMMEDIATE.

setIpv4Only :: Bool -> Socket a -> IO () #

Deprecated: Use setIpv6

setIpv6 :: Bool -> Socket a -> IO () #

zmq_setsockopt ZMQ_IPV6.

setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_LINGER.

setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_MAXMSGSIZE.

setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_MULTICAST_HOPS.

setPlainServer :: Bool -> Socket a -> IO () #

zmq_setsockopt ZMQ_PLAIN_SERVER.

setPlainPassword :: Restricted (N1, N254) ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_PLAIN_USERNAME.

setPlainUserName :: Restricted (N1, N254) ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_PLAIN_USERNAME.

setProbeRouter :: SendProbe a => Bool -> Socket a -> IO () #

zmq_setsockopt ZMQ_PROBE_ROUTER.

setRate :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RATE.

setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RCVBUF.

setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RCVHWM.

setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RCVTIMEO.

setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RECONNECT_IVL.

setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RECONNECT_IVL_MAX.

setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_RECOVERY_IVL.

setReqCorrelate :: Bool -> Socket Req -> IO () #

zmq_setsockopt ZMQ_REQ_CORRELATE.

setReqRelaxed :: Bool -> Socket Req -> IO () #

zmq_setsockopt ZMQ_REQ_RELAXED.

setRouterMandatory :: Bool -> Socket Router -> IO () #

zmq_setsockopt ZMQ_ROUTER_MANDATORY.

setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_SNDBUF.

setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_SNDHWM.

setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_SNDTIMEO.

setTcpAcceptFilter :: Maybe ByteString -> Socket a -> IO () #

zmq_setsockopt ZMQ_TCP_ACCEPT_FILTER.

setTcpKeepAlive :: Switch -> Socket a -> IO () #

zmq_setsockopt ZMQ_TCP_KEEPALIVE.

setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_TCP_KEEPALIVE_CNT.

setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_TCP_KEEPALIVE_IDLE.

setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #

zmq_setsockopt ZMQ_TCP_KEEPALIVE_INTVL.

setXPubVerbose :: Bool -> Socket XPub -> IO () #

zmq_setsockopt ZMQ_XPUB_VERBOSE.

setZapDomain :: Restricted (N1, N254) ByteString -> Socket a -> IO () #

zmq_getsockopt ZMQ_ZAP_DOMAIN.

# Restrictions

restrict :: Restriction r v => v -> Restricted r v #

Create a restricted value. If the given value does not satisfy the restrictions, a modified variant is used instead, e.g. if an integer is larger than the upper bound, the upper bound value is used.

toRestricted :: Restriction r v => v -> Maybe (Restricted r v) #

Create a restricted value. Returns `Nothing` if the given value does not satisfy all restrictions.

# Error Handling

data ZMQError #

ZMQError encapsulates information about errors, which occur when using the native 0MQ API, such as error number and message.

Instances

Eq ZMQError # |
Instance details Defined in System.ZMQ4.Internal.Error Methods (==) :: ZMQError -> ZMQError -> Bool # (/=) :: ZMQError -> ZMQError -> Bool #
Ord ZMQError # |
Instance details Defined in System.ZMQ4.Internal.Error Methods compare :: ZMQError -> ZMQError -> Ordering # (<) :: ZMQError -> ZMQError -> Bool # (<=) :: ZMQError -> ZMQError -> Bool # (>) :: ZMQError -> ZMQError -> Bool # (>=) :: ZMQError -> ZMQError -> Bool # max :: ZMQError -> ZMQError -> ZMQError # min :: ZMQError -> ZMQError -> ZMQError #
Show ZMQError # |
Instance details Defined in System.ZMQ4.Internal.Error Methods showsPrec :: Int -> ZMQError -> ShowS # show :: ZMQError -> String # showList :: [ZMQError] -> ShowS #
Exception ZMQError # |
Instance details Defined in System.ZMQ4.Internal.Error Methods toException :: ZMQError -> SomeException # fromException :: SomeException -> Maybe ZMQError # displayException :: ZMQError -> String #

errno :: ZMQError -> Int #

Error number value.

source :: ZMQError -> String #

Source where this error originates from.

message :: ZMQError -> String #

Actual error message.

# Low-level Functions

init :: Size -> IO Context #

Deprecated: Use context

term :: Context -> IO () #

Terminate a 0MQ context. Equivalent to zmq_ctx_term.

shutdown :: Context -> IO () #

Shutdown a 0MQ context. Equivalent to zmq_ctx_shutdown.

context :: IO Context #

Initialize a 0MQ context. Equivalent to zmq_ctx_new.

socket :: SocketType a => Context -> a -> IO (Socket a) #

Create a new 0MQ socket within the given context. `withSocket` provides automatic socket closing and may be safer to use.

close :: Socket a -> IO () #

Close a 0MQ socket. `withSocket` provides automatic socket closing and may be safer to use.

waitRead :: Socket a -> IO () #

Wait until data is available for reading from the given Socket. After this function returns, a call to `receive` will essentially be non-blocking.

waitWrite :: Socket a -> IO () #

Wait until data can be written to the given Socket. After this function returns, a call to `send` will essentially be non-blocking.

z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString #

z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString #

# Utils

proxy :: Socket a -> Socket b -> Maybe (Socket c) -> IO () #

Starts built-in 0MQ proxy (cf. zmq_proxy)

Proxy connects front to back socket

Before calling proxy all sockets should be bound

If the capture socket is not Nothing, the proxy shall send all messages, received on both frontend and backend, to the capture socket.

curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString) #

Generate a new curve key pair. (cf. zmq_curve_keypair)