Documentation ¶
Overview ¶
A Go interface to ZeroMQ (zmq, 0mq) version 4.
This includes partial support for ZeroMQ 4.2 DRAFT. The API pertaining to this support is subject to change.
For ZeroMQ version 3, see: http://github.com/pebbe/zmq3
For ZeroMQ version 2, see: http://github.com/pebbe/zmq2
See also the wiki: https://github.com/pebbe/zmq4/wiki
----
A note on the use of a context:
This package provides a default context. This is what will be used by the functions without a context receiver, that create a socket or manipulate the context. Package developers that import this package should probably not use the default context with its associated functions, but create their own context(s). See: type Context.
----
Since Go 1.14 you will get a lot of interrupted system calls.
See: https://golang.org/doc/go1.14#runtime
There are two options to prevent this.
The first option is to build your program with the environment variable:
GODEBUG=asyncpreemptoff=1
The second option is to let the program retry after an interrupted system call.
Initially, this is set to true, for the global context, and for contexts created with NewContext().
When you install a signal handler, for instance to handle Ctrl-C, you should probably clear this option in your signal handler. For example:
zctx, _ := zmq.NewContext() ctx, cancel := context.WithCancel(context.Background()) go func() { chSignal := make(chan os.Signal, 1) signal.Notify(chSignal, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM) <-chSignal zmq4.SetRetryAfterEINTR(false) zctx.SetRetryAfterEINTR(false) cancel() }()
----
Index ¶
- Constants
- Variables
- func AuthAllow(domain string, addresses ...string)
- func AuthCurveAdd(domain string, pubkeys ...string)
- func AuthCurvePublic(z85SecretKey string) (z85PublicKey string, err error)
- func AuthCurveRemove(domain string, pubkeys ...string)
- func AuthCurveRemoveAll(domain string)
- func AuthDeny(domain string, addresses ...string)
- func AuthMetaBlob(key, value string) (blob []byte, err error)
- func AuthPlainAdd(domain, username, password string)
- func AuthPlainRemove(domain string, usernames ...string)
- func AuthPlainRemoveAll(domain string)
- func AuthSetMetadataHandler(...)
- func AuthSetVerbose(verbose bool)
- func AuthStart() (err error)
- func AuthStop()
- func Error(e int) string
- func GetBlocky() (bool, error)
- func GetIoThreads() (int, error)
- func GetIpv6() (bool, error)
- func GetMaxMsgsz() (int, error)
- func GetMaxSockets() (int, error)
- func GetRetryAfterEINTR() bool
- func HasCurve() bool
- func HasDraft() bool
- func HasGssapi() bool
- func HasIpc() bool
- func HasNorm() bool
- func HasPgm() bool
- func HasTipc() bool
- func NewCurveKeypair() (z85_public_key, z85_secret_key string, err error)
- func Proxy(frontend, backend, capture *Socket) error
- func ProxySteerable(frontend, backend, capture, control *Socket) error
- func SetBlocky(i bool) error
- func SetIoThreads(n int) error
- func SetIpv6(i bool) error
- func SetMaxMsgsz(n int) error
- func SetMaxSockets(n int) error
- func SetRetryAfterEINTR(retry bool)
- func SetThreadPriority(n int) error
- func SetThreadSchedPolicy(n int) error
- func Term() error
- func Version() (major, minor, patch int)
- func Z85decode(s string) string
- func Z85encode(data string) string
- type Context
- func (ctx *Context) GetBlocky() (bool, error)
- func (ctx *Context) GetIoThreads() (int, error)
- func (ctx *Context) GetIpv6() (bool, error)
- func (ctx *Context) GetMaxMsgsz() (int, error)
- func (ctx *Context) GetMaxSockets() (int, error)
- func (ctx *Context) GetRetryAfterEINTR() bool
- func (ctx *Context) NewSocket(t Type) (soc *Socket, err error)
- func (ctx *Context) SetBlocky(i bool) error
- func (ctx *Context) SetIoThreads(n int) error
- func (ctx *Context) SetIpv6(i bool) error
- func (ctx *Context) SetMaxMsgsz(n int) error
- func (ctx *Context) SetMaxSockets(n int) error
- func (ctx *Context) SetRetryAfterEINTR(retry bool)
- func (ctx *Context) SetThreadPriority(n int) error
- func (ctx *Context) SetThreadSchedPolicy(n int) error
- func (ctx *Context) Term() error
- type Errno
- type Event
- type Flag
- type Mechanism
- type OptGroup
- type OptRoutingId
- type Polled
- type Poller
- func (p *Poller) Add(soc *Socket, events State) int
- func (p *Poller) Poll(timeout time.Duration) ([]Polled, error)
- func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error)
- func (p *Poller) Remove(id int) error
- func (p *Poller) RemoveBySocket(soc *Socket) error
- func (p *Poller) String() string
- func (p *Poller) Update(id int, events State) (previous State, err error)
- func (p *Poller) UpdateBySocket(soc *Socket, events State) (previous State, err error)
- type Reactor
- func (r *Reactor) AddChannel(ch <-chan interface{}, limit int, handler func(interface{}) error) (id uint64)
- func (r *Reactor) AddChannelTime(ch <-chan time.Time, limit int, handler func(interface{}) error) (id uint64)
- func (r *Reactor) AddSocket(soc *Socket, events State, handler func(State) error)
- func (r *Reactor) RemoveChannel(id uint64)
- func (r *Reactor) RemoveSocket(soc *Socket)
- func (r *Reactor) Run(interval time.Duration) (err error)
- func (r *Reactor) SetVerbose(verbose bool)
- type Socket
- func (soc *Socket) Bind(endpoint string) error
- func (client *Socket) ClientAuthCurve(server_public_key, client_public_key, client_secret_key string) error
- func (client *Socket) ClientAuthPlain(username, password string) error
- func (soc *Socket) Close() error
- func (soc *Socket) Connect(endpoint string) error
- func (soc *Socket) Context() (*Context, error)
- func (soc *Socket) Disconnect(endpoint string) error
- func (soc *Socket) GetAffinity() (uint64, error)
- func (soc *Socket) GetBacklog() (int, error)
- func (soc *Socket) GetConnectTimeout() (time.Duration, error)
- func (soc *Socket) GetCurvePublickeyRaw() (string, error)
- func (soc *Socket) GetCurvePublickeykeyZ85() (string, error)
- func (soc *Socket) GetCurveSecretkeyRaw() (string, error)
- func (soc *Socket) GetCurveSecretkeyZ85() (string, error)
- func (soc *Socket) GetCurveServerkeyRaw() (string, error)
- func (soc *Socket) GetCurveServerkeyZ85() (string, error)
- func (soc *Socket) GetEvents() (State, error)
- func (soc *Socket) GetFd() (int, error)
- func (soc *Socket) GetGssapiPlaintext() (bool, error)
- func (soc *Socket) GetGssapiPrincipal() (string, error)
- func (soc *Socket) GetGssapiServer() (bool, error)
- func (soc *Socket) GetGssapiServicePrincipal() (string, error)
- func (soc *Socket) GetHandshakeIvl() (time.Duration, error)
- func (soc *Socket) GetIdentity() (string, error)
- func (soc *Socket) GetImmediate() (bool, error)
- func (soc *Socket) GetInvertMatching() (int, error)
- func (soc *Socket) GetIpv6() (bool, error)
- func (soc *Socket) GetLastEndpoint() (string, error)
- func (soc *Socket) GetLinger() (time.Duration, error)
- func (soc *Socket) GetMaxmsgsize() (int64, error)
- func (soc *Socket) GetMechanism() (Mechanism, error)
- func (soc *Socket) GetMulticastHops() (int, error)
- func (soc *Socket) GetMulticastMaxtpdu() (int, error)
- func (soc *Socket) GetPlainPassword() (string, error)
- func (soc *Socket) GetPlainServer() (int, error)
- func (soc *Socket) GetPlainUsername() (string, error)
- func (soc *Socket) GetRate() (int, error)
- func (soc *Socket) GetRcvbuf() (int, error)
- func (soc *Socket) GetRcvhwm() (int, error)
- func (soc *Socket) GetRcvmore() (bool, error)
- func (soc *Socket) GetRcvtimeo() (time.Duration, error)
- func (soc *Socket) GetReconnectIvl() (time.Duration, error)
- func (soc *Socket) GetReconnectIvlMax() (time.Duration, error)
- func (soc *Socket) GetRecoveryIvl() (time.Duration, error)
- func (soc *Socket) GetSndbuf() (int, error)
- func (soc *Socket) GetSndhwm() (int, error)
- func (soc *Socket) GetSndtimeo() (time.Duration, error)
- func (soc *Socket) GetSocksProxy() (string, error)
- func (soc *Socket) GetTcpKeepalive() (int, error)
- func (soc *Socket) GetTcpKeepaliveCnt() (int, error)
- func (soc *Socket) GetTcpKeepaliveIdle() (int, error)
- func (soc *Socket) GetTcpKeepaliveIntvl() (int, error)
- func (soc *Socket) GetTcpMaxrt() (time.Duration, error)
- func (soc *Socket) GetThreadSafe() (bool, error)
- func (soc *Socket) GetTos() (int, error)
- func (soc *Socket) GetType() (Type, error)
- func (soc *Socket) GetVmciBufferMaxSize() (uint64, error)
- func (soc *Socket) GetVmciBufferMinSize() (uint64, error)
- func (soc *Socket) GetVmciBufferSize() (uint64, error)
- func (soc *Socket) GetVmciConnectTimeout() (time.Duration, error)
- func (soc *Socket) GetZapDomain() (string, error)
- func (soc *Socket) Getusefd() (int, error)
- func (soc *Socket) Join(group string) error
- func (soc *Socket) Leave(group string) error
- func (soc *Socket) Monitor(addr string, events Event) error
- func (soc *Socket) Recv(flags Flag) (string, error)
- func (soc *Socket) RecvBytes(flags Flag) ([]byte, error)
- func (soc *Socket) RecvBytesWithMetadata(flags Flag, properties ...string) (msg []byte, metadata map[string]string, err error)
- func (soc *Socket) RecvBytesWithOpts(flags Flag, options ...interface{}) ([]byte, []interface{}, error)
- func (soc *Socket) RecvEvent(flags Flag) (event_type Event, addr string, value int, err error)
- func (soc *Socket) RecvMessage(flags Flag) (msg []string, err error)
- func (soc *Socket) RecvMessageBytes(flags Flag) (msg [][]byte, err error)
- func (soc *Socket) RecvMessageBytesWithMetadata(flags Flag, properties ...string) (msg [][]byte, metadata map[string]string, err error)
- func (soc *Socket) RecvMessageWithMetadata(flags Flag, properties ...string) (msg []string, metadata map[string]string, err error)
- func (soc *Socket) RecvWithMetadata(flags Flag, properties ...string) (msg string, metadata map[string]string, err error)
- func (soc *Socket) RecvWithOpts(flags Flag, options ...interface{}) (string, []interface{}, error)
- func (soc *Socket) Send(data string, flags Flag, options ...interface{}) (int, error)
- func (soc *Socket) SendBytes(data []byte, flags Flag, options ...interface{}) (int, error)
- func (soc *Socket) SendMessage(parts ...interface{}) (total int, err error)
- func (soc *Socket) SendMessageDontwait(parts ...interface{}) (total int, err error)
- func (server *Socket) ServerAuthCurve(domain, secret_key string) error
- func (server *Socket) ServerAuthNull(domain string) error
- func (server *Socket) ServerAuthPlain(domain string) error
- func (soc *Socket) SetAffinity(value uint64) error
- func (soc *Socket) SetBacklog(value int) error
- func (soc *Socket) SetConflate(value bool) error
- func (soc *Socket) SetConnectRid(value string) error
- func (soc *Socket) SetConnectTimeout(value time.Duration) error
- func (soc *Socket) SetCurvePublickey(key string) error
- func (soc *Socket) SetCurveSecretkey(key string) error
- func (soc *Socket) SetCurveServer(value int) error
- func (soc *Socket) SetCurveServerkey(key string) error
- func (soc *Socket) SetGssapiPlaintext(value bool) error
- func (soc *Socket) SetGssapiPrincipal(value string) error
- func (soc *Socket) SetGssapiServer(value bool) error
- func (soc *Socket) SetGssapiServicePrincipal(value string) error
- func (soc *Socket) SetHandshakeIvl(value time.Duration) error
- func (soc *Socket) SetHeartbeatIvl(value time.Duration) error
- func (soc *Socket) SetHeartbeatTimeout(value time.Duration) error
- func (soc *Socket) SetHeartbeatTtl(value time.Duration) error
- func (soc *Socket) SetIdentity(value string) error
- func (soc *Socket) SetImmediate(value bool) error
- func (soc *Socket) SetInvertMatching(value int) error
- func (soc *Socket) SetIpv6(value bool) error
- func (soc *Socket) SetLinger(value time.Duration) error
- func (soc *Socket) SetMaxmsgsize(value int64) error
- func (soc *Socket) SetMulticastHops(value int) error
- func (soc *Socket) SetMulticastMaxtpdu(value int) error
- func (soc *Socket) SetPlainPassword(password string) error
- func (soc *Socket) SetPlainServer(value int) error
- func (soc *Socket) SetPlainUsername(username string) error
- func (soc *Socket) SetProbeRouter(value int) error
- func (soc *Socket) SetRate(value int) error
- func (soc *Socket) SetRcvbuf(value int) error
- func (soc *Socket) SetRcvhwm(value int) error
- func (soc *Socket) SetRcvtimeo(value time.Duration) error
- func (soc *Socket) SetReconnectIvl(value time.Duration) error
- func (soc *Socket) SetReconnectIvlMax(value time.Duration) error
- func (soc *Socket) SetRecoveryIvl(value time.Duration) error
- func (soc *Socket) SetReqCorrelate(value int) error
- func (soc *Socket) SetReqRelaxed(value int) error
- func (soc *Socket) SetRouterHandover(value bool) error
- func (soc *Socket) SetRouterMandatory(value int) error
- func (soc *Socket) SetRouterRaw(value int) error
- func (soc *Socket) SetSndbuf(value int) error
- func (soc *Socket) SetSndhwm(value int) error
- func (soc *Socket) SetSndtimeo(value time.Duration) error
- func (soc *Socket) SetSocksProxy(value string) error
- func (soc *Socket) SetStreamNotify(value int) error
- func (soc *Socket) SetSubscribe(filter string) error
- func (soc *Socket) SetTcpAcceptFilter(filter string) error
- func (soc *Socket) SetTcpKeepalive(value int) error
- func (soc *Socket) SetTcpKeepaliveCnt(value int) error
- func (soc *Socket) SetTcpKeepaliveIdle(value int) error
- func (soc *Socket) SetTcpKeepaliveIntvl(value int) error
- func (soc *Socket) SetTcpMaxrt(value time.Duration) error
- func (soc *Socket) SetTos(value int) error
- func (soc *Socket) SetUnsubscribe(filter string) error
- func (soc *Socket) SetUseFd(value int) error
- func (soc *Socket) SetVmciBufferMaxSize(value uint64) error
- func (soc *Socket) SetVmciBufferMinSize(value uint64) error
- func (soc *Socket) SetVmciBufferSize(value uint64) error
- func (soc *Socket) SetVmciConnectTimeout(value time.Duration) error
- func (soc *Socket) SetXpubManual(value int) error
- func (soc *Socket) SetXpubNodrop(value bool) error
- func (soc *Socket) SetXpubVerbose(value int) error
- func (soc *Socket) SetXpubVerboser(value int) error
- func (soc *Socket) SetXpubWelcomeMsg(value string) error
- func (soc *Socket) SetZapDomain(domain string) error
- func (soc Socket) String() string
- func (soc *Socket) Unbind(endpoint string) error
- type State
- type Type
Constants ¶
const ( // On Windows platform some of the standard POSIX errnos are not defined. EADDRINUSE = Errno(C.EADDRINUSE) EADDRNOTAVAIL = Errno(C.EADDRNOTAVAIL) EAFNOSUPPORT = Errno(C.EAFNOSUPPORT) ECONNABORTED = Errno(C.ECONNABORTED) ECONNREFUSED = Errno(C.ECONNREFUSED) ECONNRESET = Errno(C.ECONNRESET) EHOSTUNREACH = Errno(C.EHOSTUNREACH) EINPROGRESS = Errno(C.EINPROGRESS) EMSGSIZE = Errno(C.EMSGSIZE) ENETDOWN = Errno(C.ENETDOWN) ENETRESET = Errno(C.ENETRESET) ENETUNREACH = Errno(C.ENETUNREACH) ENOBUFS = Errno(C.ENOBUFS) ENOTCONN = Errno(C.ENOTCONN) ENOTSOCK = Errno(C.ENOTSOCK) ENOTSUP = Errno(C.ENOTSUP) EPROTONOSUPPORT = Errno(C.EPROTONOSUPPORT) ETIMEDOUT = Errno(C.ETIMEDOUT) // Native 0MQ error codes. EFSM = Errno(C.EFSM) EMTHREAD = Errno(C.EMTHREAD) ENOCOMPATPROTO = Errno(C.ENOCOMPATPROTO) ETERM = Errno(C.ETERM) )
const ( MaxSocketsDflt = int(C.ZMQ_MAX_SOCKETS_DFLT) IoThreadsDflt = int(C.ZMQ_IO_THREADS_DFLT) )
const ( // Constants for NewSocket() // See: http://api.zeromq.org/4-1:zmq-socket#toc3 REQ = Type(C.ZMQ_REQ) REP = Type(C.ZMQ_REP) DEALER = Type(C.ZMQ_DEALER) ROUTER = Type(C.ZMQ_ROUTER) PUB = Type(C.ZMQ_PUB) SUB = Type(C.ZMQ_SUB) XPUB = Type(C.ZMQ_XPUB) XSUB = Type(C.ZMQ_XSUB) PUSH = Type(C.ZMQ_PUSH) PULL = Type(C.ZMQ_PULL) PAIR = Type(C.ZMQ_PAIR) STREAM = Type(C.ZMQ_STREAM) // DRAFT SERVER = Type(C.ZMQ_SERVER) CLIENT = Type(C.ZMQ_CLIENT) RADIO = Type(C.ZMQ_RADIO) DISH = Type(C.ZMQ_DISH) GATHER = Type(C.ZMQ_GATHER) SCATTER = Type(C.ZMQ_SCATTER) DGRAM = Type(C.ZMQ_DGRAM) )
const ( // Flags for (*Socket)Send(), (*Socket)Recv() // For Send, see: http://api.zeromq.org/4-1:zmq-send#toc2 // For Recv, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 DONTWAIT = Flag(C.ZMQ_DONTWAIT) SNDMORE = Flag(C.ZMQ_SNDMORE) )
const ( // Flags for (*Socket)Monitor() and (*Socket)RecvEvent() // See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3 EVENT_ALL = Event(C.ZMQ_EVENT_ALL) EVENT_CONNECTED = Event(C.ZMQ_EVENT_CONNECTED) EVENT_CONNECT_DELAYED = Event(C.ZMQ_EVENT_CONNECT_DELAYED) EVENT_CONNECT_RETRIED = Event(C.ZMQ_EVENT_CONNECT_RETRIED) EVENT_LISTENING = Event(C.ZMQ_EVENT_LISTENING) EVENT_BIND_FAILED = Event(C.ZMQ_EVENT_BIND_FAILED) EVENT_ACCEPTED = Event(C.ZMQ_EVENT_ACCEPTED) EVENT_ACCEPT_FAILED = Event(C.ZMQ_EVENT_ACCEPT_FAILED) EVENT_CLOSED = Event(C.ZMQ_EVENT_CLOSED) EVENT_CLOSE_FAILED = Event(C.ZMQ_EVENT_CLOSE_FAILED) EVENT_DISCONNECTED = Event(C.ZMQ_EVENT_DISCONNECTED) EVENT_MONITOR_STOPPED = Event(C.ZMQ_EVENT_MONITOR_STOPPED) EVENT_HANDSHAKE_FAILED_NO_DETAIL = Event(C.ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL) EVENT_HANDSHAKE_SUCCEEDED = Event(C.ZMQ_EVENT_HANDSHAKE_SUCCEEDED) EVENT_HANDSHAKE_FAILED_PROTOCOL = Event(C.ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL) EVENT_HANDSHAKE_FAILED_AUTH = Event(C.ZMQ_EVENT_HANDSHAKE_FAILED_AUTH) )
const ( // Flags for (*Socket)GetEvents() // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc8 POLLIN = State(C.ZMQ_POLLIN) POLLOUT = State(C.ZMQ_POLLOUT) )
const ( // Constants for (*Socket)GetMechanism() // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc22 NULL = Mechanism(C.ZMQ_NULL) PLAIN = Mechanism(C.ZMQ_PLAIN) CURVE = Mechanism(C.ZMQ_CURVE) GSSAPI = Mechanism(C.ZMQ_GSSAPI) )
const CURVE_ALLOW_ANY = "*"
Variables ¶
var ( ErrorContextClosed = errors.New("Context is closed") ErrorSocketClosed = errors.New("Socket is closed") ErrorMoreExpected = errors.New("More expected") ErrorNotImplemented405 = errors.New("Not implemented, requires 0MQ version 4.0.5") ErrorNotImplemented41 = errors.New("Not implemented, requires 0MQ version 4.1") ErrorNotImplemented42 = errors.New("Not implemented, requires 0MQ version 4.2") ErrorNotImplemented42draft = errors.New("Not implemented, requires 0MQ version 4.2 with drafts enabled") ErrorNotImplementedWindows = errors.New("Not implemented on Windows") ErrorNoSocket = errors.New("No such socket") )
Functions ¶
func AuthAllow ¶
Allow (whitelist) some addresses for a domain.
An address can be a single IP address, or an IP address and mask in CIDR notation.
For NULL, all clients from these addresses will be accepted.
For PLAIN and CURVE, they will be allowed to continue with authentication.
You can call this method multiple times to whitelist multiple IP addresses.
If you whitelist a single address for a domain, any non-whitelisted addresses for that domain are treated as blacklisted.
Use domain "*" for all domains.
For backward compatibility: if domain can be parsed as an IP address, it will be interpreted as another address, and it and all remaining addresses will be added to all domains.
func AuthCurveAdd ¶
Add public user keys for CURVE authentication for a given domain.
To cover all domains, use "*".
Public keys are in Z85 printable text format.
To allow all client keys without checking, specify CURVE_ALLOW_ANY for the key.
func AuthCurvePublic ¶
Helper function to derive z85 public key from secret key
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func AuthCurveRemove ¶
Remove user keys from CURVE authentication for a given domain.
func AuthCurveRemoveAll ¶
func AuthCurveRemoveAll(domain string)
Remove all user keys from CURVE authentication for a given domain.
func AuthDeny ¶
Deny (blacklist) some addresses for a domain.
An address can be a single IP address, or an IP address and mask in CIDR notation.
For all security mechanisms, this rejects the connection without any further authentication.
Use either a whitelist for a domain, or a blacklist for a domain, not both. If you define both a whitelist and a blacklist for a domain, only the whitelist takes effect.
Use domain "*" for all domains.
For backward compatibility: if domain can be parsed as an IP address, it will be interpreted as another address, and it and all remaining addresses will be added to all domains.
func AuthMetaBlob ¶
This encodes a key/value pair into the format used by a ZAP handler.
Returns an error if key is more then 255 characters long.
func AuthPlainAdd ¶
func AuthPlainAdd(domain, username, password string)
Add a user for PLAIN authentication for a given domain.
Set `domain` to "*" to apply to all domains.
func AuthPlainRemove ¶
Remove users from PLAIN authentication for a given domain.
func AuthPlainRemoveAll ¶
func AuthPlainRemoveAll(domain string)
Remove all users from PLAIN authentication for a given domain.
func AuthSetMetadataHandler ¶
func AuthSetMetadataHandler( handler func( version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string))
This function sets the metadata handler that is called by the ZAP handler to retrieve key/value properties that should be set on reply messages in case of a status code "200" (succes).
Default properties are `Socket-Type`, which is already set, and `Identity` and `User-Id` that are empty by default. The last two can be set, and more properties can be added.
The `User-Id` property is used for the `user id` frame of the reply message. All other properties are stored in the `metadata` frame of the reply message.
The default handler returns an empty map.
For the meaning of the handler arguments, and other details, see: http://rfc.zeromq.org/spec:27#toc10
func AuthSetVerbose ¶
func AuthSetVerbose(verbose bool)
Enable verbose tracing of commands and activity.
func AuthStart ¶
func AuthStart() (err error)
Start authentication.
Note that until you add policies, all incoming NULL connections are allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections are denied.
func GetBlocky ¶
Returns the blocky setting in the default context.
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func GetIoThreads ¶
Returns the size of the 0MQ thread pool in the default context.
func GetMaxMsgsz ¶
Returns the maximum message size in the default context.
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func GetMaxSockets ¶
Returns the maximum number of sockets allowed in the default context.
func GetRetryAfterEINTR ¶ added in v1.1.0
func GetRetryAfterEINTR() bool
Returns the retry after EINTR setting in the default context.
func HasCurve ¶
func HasCurve() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the CURVE security mechanism
func HasGssapi ¶
func HasGssapi() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the GSSAPI security mechanism
func HasIpc ¶
func HasIpc() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the ipc:// protocol
func HasNorm ¶
func HasNorm() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the norm:// protocol
func HasPgm ¶
func HasPgm() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the pgm:// protocol
func HasTipc ¶
func HasTipc() bool
Returns false for ZeroMQ version < 4.1.0
Else: returns true if the library supports the tipc:// protocol
func NewCurveKeypair ¶
Generate a new CURVE keypair
func ProxySteerable ¶
Start built-in ØMQ proxy with PAUSE/RESUME/TERMINATE control flow
Returns ErrorNotImplemented405 with ZeroMQ version < 4.0.5
func SetBlocky ¶
Sets the blocky behavior in the default context.
See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func SetIoThreads ¶
Specifies the size of the 0MQ thread pool to handle I/O operations in the default context. If your application is using only the inproc transport for messaging you may set this to zero, otherwise set it to at least one. This option only applies before creating any sockets.
Default value: 1
func SetIpv6 ¶
Sets the IPv6 value for all sockets created in the default context from this point onwards. A value of true means IPv6 is enabled, while false means the socket will use only IPv4. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts.
Default value: false
func SetMaxMsgsz ¶
Set maximum message size in the default context.
Default value: INT_MAX
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func SetMaxSockets ¶
Sets the maximum number of sockets allowed in the default context.
Default value: 1024
func SetRetryAfterEINTR ¶ added in v1.1.0
func SetRetryAfterEINTR(retry bool)
Sets the retry after EINTR setting in the default context.
func SetThreadPriority ¶
Sets scheduling priority for default context’s thread pool.
This option requires ZeroMQ version 4.1, and is not available on Windows.
Supported values for this option depend on chosen scheduling policy. Details can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
This option only applies before creating any sockets on the context.
Default value: -1
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
Returns ErrorNotImplementedWindows on Windows
func SetThreadSchedPolicy ¶
Sets the scheduling policy for default context’s thread pool.
This option requires ZeroMQ version 4.1, and is not available on Windows.
Supported values for this option can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
This option only applies before creating any sockets on the context.
Default value: -1
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
Returns ErrorNotImplementedWindows on Windows
func Term ¶
func Term() error
Terminates the default context.
For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
A context that is not the default context.
func (*Context) GetBlocky ¶
Returns the blocky setting.
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Context) GetIoThreads ¶
Returns the size of the 0MQ thread pool.
func (*Context) GetMaxMsgsz ¶
Returns the maximum message size.
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Context) GetMaxSockets ¶
Returns the maximum number of sockets allowed.
func (*Context) GetRetryAfterEINTR ¶ added in v1.1.0
Returns the retry after EINTR setting.
func (*Context) NewSocket ¶
Create 0MQ socket in the given context.
WARNING: The Socket is not thread safe. This means that you cannot access the same Socket from different goroutines without using something like a mutex.
For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3
func (*Context) SetBlocky ¶
Sets the blocky behavior.
See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Context) SetIoThreads ¶
Specifies the size of the 0MQ thread pool to handle I/O operations. If your application is using only the inproc transport for messaging you may set this to zero, otherwise set it to at least one. This option only applies before creating any sockets.
Default value: 1
func (*Context) SetIpv6 ¶
Sets the IPv6 value for all sockets created in the context from this point onwards. A value of true means IPv6 is enabled, while false means the socket will use only IPv4. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts.
Default value: false
func (*Context) SetMaxMsgsz ¶
Set maximum message size.
Default value: INT_MAX
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Context) SetRetryAfterEINTR ¶ added in v1.1.0
Sets the retry after EINTR setting.
func (*Context) SetThreadPriority ¶
Sets scheduling priority for internal context’s thread pool.
This option requires ZeroMQ version 4.1, and is not available on Windows.
Supported values for this option depend on chosen scheduling policy. Details can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
This option only applies before creating any sockets on the context.
Default value: -1
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
Returns ErrorNotImplementedWindows on Windows
func (*Context) SetThreadSchedPolicy ¶
Sets the scheduling policy for internal context’s thread pool.
This option requires ZeroMQ version 4.1, and is not available on Windows.
Supported values for this option can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
This option only applies before creating any sockets on the context.
Default value: -1
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
Returns ErrorNotImplementedWindows on Windows
func (*Context) Term ¶
Terminates the context.
For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term
type Errno ¶
type Errno uintptr
An Errno is an unsigned number describing an error condition as returned by a call to ZeroMQ. It implements the error interface. The number is either a standard system error, or an error defined by the C library of ZeroMQ.
type Mechanism ¶
type Mechanism int
Specifies the security mechanism, used by (*Socket)GetMechanism()
type OptRoutingId ¶
type OptRoutingId uint32
type Polled ¶
type Polled struct { Socket *Socket // socket with matched event(s) Events State // actual matched event(s) }
Return type for (*Poller)Poll
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
func (*Poller) Add ¶
Add items to the poller
Events is a bitwise OR of zmq.POLLIN and zmq.POLLOUT ¶
Returns the id of the item, which can be used as a handle to (*Poller)Update and as an index into the result of (*Poller)PollAll
func (*Poller) Poll ¶
Input/output multiplexing
If timeout < 0, wait forever until a matching event is detected
Only sockets with matching socket events are returned in the list.
Example:
poller := zmq.NewPoller() poller.Add(socket0, zmq.POLLIN) poller.Add(socket1, zmq.POLLIN) // Process messages from both sockets for { sockets, _ := poller.Poll(-1) for _, socket := range sockets { switch s := socket.Socket; s { case socket0: msg, _ := s.Recv(0) // Process msg case socket1: msg, _ := s.Recv(0) // Process msg } } }
func (*Poller) PollAll ¶
This is like (*Poller)Poll, but it returns a list of all sockets, in the same order as they were added to the poller, not just those sockets that had an event.
For each socket in the list, you have to check the Events field to see if there was actually an event.
When error is not nil, the return list contains no sockets.
func (*Poller) Remove ¶
Remove a socket from the poller
Returns ErrorNoSocket if the id was out of range
func (*Poller) RemoveBySocket ¶
Remove a socket from the poller
Returns ErrorNoSocket if the socket didn't match
func (*Poller) Update ¶
Update the events mask of a socket in the poller
Replaces the Poller's bitmask for the specified id with the events parameter passed ¶
Returns the previous value, or ErrorNoSocket if the id was out of range
func (*Poller) UpdateBySocket ¶
Update the events mask of a socket in the poller
Replaces the Poller's bitmask for the specified socket with the events parameter passed ¶
Returns the previous value, or ErrorNoSocket if the socket didn't match
type Reactor ¶
type Reactor struct {
// contains filtered or unexported fields
}
func NewReactor ¶
func NewReactor() *Reactor
Create a reactor to mix the handling of sockets and channels (timers or other channels).
Example:
reactor := zmq.NewReactor() reactor.AddSocket(socket1, zmq.POLLIN, socket1_handler) reactor.AddSocket(socket2, zmq.POLLIN, socket2_handler) reactor.AddChannelTime(time.Tick(time.Second), 1, ticker_handler) reactor.Run(time.Second)
func (*Reactor) AddChannel ¶
func (r *Reactor) AddChannel(ch <-chan interface{}, limit int, handler func(interface{}) error) (id uint64)
Add channel handler to the reactor.
Returns id of added handler, that can be used later to remove it.
If limit is positive, at most this many items will be handled in each run through the main loop, otherwise it will process as many items as possible.
The handler function receives the value received from the channel.
func (*Reactor) AddChannelTime ¶
func (r *Reactor) AddChannelTime(ch <-chan time.Time, limit int, handler func(interface{}) error) (id uint64)
This function wraps AddChannel, using a channel of type time.Time instead of type interface{}.
func (*Reactor) AddSocket ¶
Add socket handler to the reactor.
You can have only one handler per socket. Adding a second one will remove the first.
The handler receives the socket state as an argument: POLLIN, POLLOUT, or both.
func (*Reactor) RemoveChannel ¶
Remove a channel from the reactor.
Closed channels are removed automatically.
func (*Reactor) RemoveSocket ¶
Remove a socket handler from the reactor.
func (*Reactor) Run ¶
Run the reactor.
The interval determines the time-out on the polling of sockets. Interval must be positive if there are channels. If there are no channels, you can set interval to -1.
The run alternates between polling/handling sockets (using the interval as timeout), and reading/handling channels. The reading of channels is without time-out: if there is no activity on any channel, the run continues to poll sockets immediately.
The run exits when any handler returns an error, returning that same error.
func (*Reactor) SetVerbose ¶
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket functions starting with `Set` or `Get` are used for setting and getting socket options.
func NewSocket ¶
Create 0MQ socket in the default context.
WARNING: The Socket is not thread safe. This means that you cannot access the same Socket from different goroutines without using something like a mutex.
For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3
func (*Socket) Bind ¶
Accept incoming connections on a socket.
For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-bind#toc2
func (*Socket) ClientAuthCurve ¶
func (client *Socket) ClientAuthCurve(server_public_key, client_public_key, client_secret_key string) error
Set CURVE client role.
func (*Socket) ClientAuthPlain ¶
Set PLAIN client role.
func (*Socket) Connect ¶
Create outgoing connection from socket.
For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-connect#toc2
func (*Socket) Disconnect ¶
Disconnect a socket.
For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-disconnect#toc2
func (*Socket) GetAffinity ¶
ZMQ_AFFINITY: Retrieve I/O thread affinity
func (*Socket) GetBacklog ¶
ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections
func (*Socket) GetConnectTimeout ¶
ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetCurvePublickeyRaw ¶
ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key
func (*Socket) GetCurvePublickeykeyZ85 ¶
ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key
func (*Socket) GetCurveSecretkeyRaw ¶
ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key
func (*Socket) GetCurveSecretkeyZ85 ¶
ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key
func (*Socket) GetCurveServerkeyRaw ¶
ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key
func (*Socket) GetCurveServerkeyZ85 ¶
ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key
func (*Socket) GetGssapiPlaintext ¶
ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetGssapiPrincipal ¶
ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetGssapiServer ¶
ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetGssapiServicePrincipal ¶
ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetHandshakeIvl ¶
ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetIdentity ¶
ZMQ_IDENTITY: Retrieve socket identity
func (*Socket) GetImmediate ¶
ZMQ_IMMEDIATE: Retrieve attach-on-connect value
func (*Socket) GetInvertMatching ¶
ZMQ_INVERT_MATCHING: Retrieve inverted filtering status
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetLastEndpoint ¶
ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set
func (*Socket) GetLinger ¶
ZMQ_LINGER: Retrieve linger period for socket shutdown
Returns time.Duration(-1) for infinite ¶
func (*Socket) GetMaxmsgsize ¶
ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
func (*Socket) GetMechanism ¶
ZMQ_MECHANISM: Retrieve current security mechanism
func (*Socket) GetMulticastHops ¶
ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
func (*Socket) GetMulticastMaxtpdu ¶
ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetPlainPassword ¶
ZMQ_PLAIN_PASSWORD: Retrieve current password
func (*Socket) GetPlainServer ¶
ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role
func (*Socket) GetPlainUsername ¶
ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username
func (*Socket) GetRcvmore ¶
ZMQ_RCVMORE: More message data parts to follow
func (*Socket) GetRcvtimeo ¶
ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN
Returns time.Duration(-1) for infinite ¶
func (*Socket) GetReconnectIvl ¶
ZMQ_RECONNECT_IVL: Retrieve reconnection interval
Returns time.Duration(-1) for no reconnection ¶
func (*Socket) GetReconnectIvlMax ¶
ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval
func (*Socket) GetRecoveryIvl ¶
ZMQ_RECOVERY_IVL: Get multicast recovery interval
func (*Socket) GetSndtimeo ¶
ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN
Returns time.Duration(-1) for infinite ¶
func (*Socket) GetSocksProxy ¶
ZMQ_SOCKS_PROXY: NOT DOCUMENTED
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetTcpKeepalive ¶
ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
func (*Socket) GetTcpKeepaliveCnt ¶
ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option
func (*Socket) GetTcpKeepaliveIdle ¶
ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS)
func (*Socket) GetTcpKeepaliveIntvl ¶
ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option
func (*Socket) GetTcpMaxrt ¶
ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetThreadSafe ¶
ZMQ_THREAD_SAFE: Retrieve socket thread safety
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetTos ¶
ZMQ_TOS: Retrieve the Type-of-Service socket override status
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) GetVmciBufferMaxSize ¶
ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetVmciBufferMinSize ¶
ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetVmciBufferSize ¶
ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetVmciConnectTimeout ¶
ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) GetZapDomain ¶
ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain
func (*Socket) Getusefd ¶
ZMQ_USE_FD: Retrieve the pre-allocated socket file descriptor
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) Monitor ¶
Register a monitoring callback.
See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc2
WARNING: Closing a context with a monitoring callback will lead to random crashes. This is a bug in the ZeroMQ library. The monitoring callback has the same context as the socket it was created for.
Example:
package main import ( zmq "github.com/pebbe/zmq4" "log" "time" ) func rep_socket_monitor(addr string) { s, err := zmq.NewSocket(zmq.PAIR) if err != nil { log.Fatalln(err) } err = s.Connect(addr) if err != nil { log.Fatalln(err) } for { a, b, c, err := s.RecvEvent(0) if err != nil { log.Println(err) break } log.Println(a, b, c) } s.Close() } func main() { // REP socket rep, err := zmq.NewSocket(zmq.REP) if err != nil { log.Fatalln(err) } // REP socket monitor, all events err = rep.Monitor("inproc://monitor.rep", zmq.EVENT_ALL) if err != nil { log.Fatalln(err) } go rep_socket_monitor("inproc://monitor.rep") // Generate an event rep.Bind("tcp://*:5555") if err != nil { log.Fatalln(err) } // Allow some time for event detection time.Sleep(time.Second) rep.Close() zmq.Term() }
func (*Socket) Recv ¶
Receive a message part from a socket.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
func (*Socket) RecvBytes ¶
Receive a message part from a socket.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
func (*Socket) RecvBytesWithMetadata ¶
func (soc *Socket) RecvBytesWithMetadata(flags Flag, properties ...string) (msg []byte, metadata map[string]string, err error)
Receive a message part with metadata.
This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata.
The returned metadata map contains only those properties that exist on the message.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3
func (*Socket) RecvBytesWithOpts ¶
func (soc *Socket) RecvBytesWithOpts(flags Flag, options ...interface{}) ([]byte, []interface{}, error)
Receive a message part from a socket, including message options.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
Valid options are
- OptRoutingId(0)
- OptGroup("")
func (*Socket) RecvEvent ¶
Receive a message part from a socket interpreted as an event.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
For a description of event_type, see: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3
For an example, see: func (*Socket) Monitor
func (*Socket) RecvMessageBytes ¶
Receive parts as message from socket.
Returns last non-nil error code.
func (*Socket) RecvMessageBytesWithMetadata ¶
func (soc *Socket) RecvMessageBytesWithMetadata(flags Flag, properties ...string) (msg [][]byte, metadata map[string]string, err error)
Receive parts as message from socket, including metadata.
Metadata is picked from the first message part.
For details about metadata, see RecvBytesWithMetadata().
Returns last non-nil error code.
func (*Socket) RecvMessageWithMetadata ¶
func (soc *Socket) RecvMessageWithMetadata(flags Flag, properties ...string) (msg []string, metadata map[string]string, err error)
Receive parts as message from socket, including metadata.
Metadata is picked from the first message part.
For details about metadata, see RecvWithMetadata().
Returns last non-nil error code.
func (*Socket) RecvWithMetadata ¶
func (soc *Socket) RecvWithMetadata(flags Flag, properties ...string) (msg string, metadata map[string]string, err error)
Receive a message part with metadata.
This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata.
The returned metadata map contains only those properties that exist on the message.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3
func (*Socket) RecvWithOpts ¶
Receive a message part from a socket, including message options.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2
Valid options are
- OptRoutingId(0)
- OptGroup("")
func (*Socket) Send ¶
Send a message part on a socket.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2
func (*Socket) SendBytes ¶
Send a message part on a socket.
For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2
func (*Socket) SendMessage ¶
Send multi-part message on socket.
Any `[]string' or `[][]byte' is split into separate `string's or `[]byte's
Any other part that isn't a `string' or `[]byte' is converted to `string' with `fmt.Sprintf("%v", part)'.
Returns total bytes sent.
func (*Socket) SendMessageDontwait ¶
Like SendMessage(), but adding the DONTWAIT flag.
func (*Socket) ServerAuthCurve ¶
Set CURVE server role.
func (*Socket) ServerAuthNull ¶
Set NULL server role.
func (*Socket) ServerAuthPlain ¶
Set PLAIN server role.
func (*Socket) SetAffinity ¶
ZMQ_AFFINITY: Set I/O thread affinity
func (*Socket) SetBacklog ¶
ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections
func (*Socket) SetConflate ¶
ZMQ_CONFLATE: Keep only last message
func (*Socket) SetConnectRid ¶
ZMQ_CONNECT_RID: Assign the next outbound connection id
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetConnectTimeout ¶
ZMQ_CONNECT_TIMEOUT: Set connect() timeout
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetCurvePublickey ¶
ZMQ_CURVE_PUBLICKEY: Set CURVE public key
func (*Socket) SetCurveSecretkey ¶
ZMQ_CURVE_SECRETKEY: Set CURVE secret key
func (*Socket) SetCurveServer ¶
ZMQ_CURVE_SERVER: Set CURVE server role
func (*Socket) SetCurveServerkey ¶
ZMQ_CURVE_SERVERKEY: Set CURVE server key
func (*Socket) SetGssapiPlaintext ¶
ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetGssapiPrincipal ¶
ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetGssapiServer ¶
ZMQ_GSSAPI_SERVER: Set GSSAPI server role
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetGssapiServicePrincipal ¶
ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetHandshakeIvl ¶
ZMQ_HANDSHAKE_IVL: Set maximum handshake interval
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetHeartbeatIvl ¶
ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetHeartbeatTimeout ¶
ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetHeartbeatTtl ¶
ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetIdentity ¶
ZMQ_IDENTITY: Set socket identity
func (*Socket) SetImmediate ¶
ZMQ_IMMEDIATE: Queue messages only to completed connections
func (*Socket) SetInvertMatching ¶
ZMQ_INVERT_MATCHING: Invert message filtering
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetMaxmsgsize ¶
ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
func (*Socket) SetMulticastHops ¶
ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
func (*Socket) SetMulticastMaxtpdu ¶
ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetPlainPassword ¶
ZMQ_PLAIN_PASSWORD: Set PLAIN security password
func (*Socket) SetPlainServer ¶
ZMQ_PLAIN_SERVER: Set PLAIN server role
func (*Socket) SetPlainUsername ¶
ZMQ_PLAIN_USERNAME: Set PLAIN security username
func (*Socket) SetProbeRouter ¶
ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets
func (*Socket) SetRcvtimeo ¶
ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
For infinite, use -1 ¶
func (*Socket) SetReconnectIvl ¶
ZMQ_RECONNECT_IVL: Set reconnection interval
For no reconnection, use -1 ¶
func (*Socket) SetReconnectIvlMax ¶
ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval
func (*Socket) SetRecoveryIvl ¶
ZMQ_RECOVERY_IVL: Set multicast recovery interval
func (*Socket) SetReqCorrelate ¶
ZMQ_REQ_CORRELATE: match replies with requests
func (*Socket) SetReqRelaxed ¶
ZMQ_REQ_RELAXED: relax strict alternation between request and reply
func (*Socket) SetRouterHandover ¶
ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetRouterMandatory ¶
ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets
func (*Socket) SetRouterRaw ¶
ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode
This option is deprecated since ZeroMQ version 4.1, please use ZMQ_STREAM sockets instead.
func (*Socket) SetSndtimeo ¶
ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
For infinite, use -1 ¶
func (*Socket) SetSocksProxy ¶
ZMQ_SOCKS_PROXY: NOT DOCUMENTED
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetStreamNotify ¶
ZMQ_STREAM_NOTIFY: send connect and disconnect notifications
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetSubscribe ¶
ZMQ_SUBSCRIBE: Establish message filter
func (*Socket) SetTcpAcceptFilter ¶
ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections
This option is deprecated since ZeroMQ version 4.1, please use authentication via the ZAP API and IP address whitelisting / blacklisting.
func (*Socket) SetTcpKeepalive ¶
ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
func (*Socket) SetTcpKeepaliveCnt ¶
ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option
func (*Socket) SetTcpKeepaliveIdle ¶
ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS)
func (*Socket) SetTcpKeepaliveIntvl ¶
ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option
func (*Socket) SetTcpMaxrt ¶
ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetTos ¶
ZMQ_TOS: Set the Type-of-Service on socket
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetUnsubscribe ¶
ZMQ_UNSUBSCRIBE: Remove message filter
func (*Socket) SetUseFd ¶
ZMQ_USE_FD: Set the pre-allocated socket file descriptor
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetVmciBufferMaxSize ¶
ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetVmciBufferMinSize ¶
ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetVmciBufferSize ¶
ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetVmciConnectTimeout ¶
ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetXpubManual ¶
ZMQ_XPUB_MANUAL: change the subscription handling to manual
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetXpubNodrop ¶
ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached
Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
func (*Socket) SetXpubVerbose ¶
ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets
func (*Socket) SetXpubVerboser ¶
ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetXpubWelcomeMsg ¶
ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by subscriber when connecting
Returns ErrorNotImplemented42 with ZeroMQ version < 4.2
func (*Socket) SetZapDomain ¶
ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain