zmq2

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2021 License: BSD-2-Clause Imports: 8 Imported by: 10

README

A Go interface to ZeroMQ version 2.

Go Report Card GoDoc

Requires ZeroMQ version 2.1 or 2.2

For ZeroMQ version 4, see: http://github.com/pebbe/zmq4

For ZeroMQ version 3, see: http://github.com/pebbe/zmq3

Including all examples of ØMQ - The Guide.

Keywords: zmq, zeromq, 0mq, networks, distributed computing, message passing, fanout, pubsub, pipeline, request-reply

See also

  • go-zeromq/zmq4 — A pure-Go implementation of ØMQ (ZeroMQ), version 4
  • go-nanomsg — Language bindings for nanomsg in Go
  • goczmq — A Go interface to CZMQ
  • Mangos — An implementation in pure Go of the SP ("Scalable Protocols") protocols

Requirements

zmq2 is just a wrapper for the ZeroMQ library. It doesn't include the library itself. So you need to have ZeroMQ installed, including its development files. On Linux and Darwin you can check this with ($ is the command prompt):

$ pkg-config --modversion libzmq
2.2.0

The Go compiler must be able to compile C code. You can check this with:

$ go env CGO_ENABLED
1

You can't do cross-compilation. That would disable C.

Install

go get github.com/pebbe/zmq2

Docs

Support for ZeroMQ version 2.1

  • The following functions are not supported in ZeroMQ version 2.1, and will return an error:
  • (*Socket) GetRcvtimeo
  • (*Socket) GetSndtimeo
  • (*Socket) SetRcvtimeo
  • (*Socket) SetSndtimeo

Documentation

Overview

A Go interface to ZeroMQ (zmq, 0mq) version 2.

For ZeroMQ version 4, see: http://github.com/pebbe/zmq4

For ZeroMQ version 3, see: http://github.com/pebbe/zmq3

Requires ZeroMQ version 2.1 or 2.2

The following functions return ErrorNotImplemented in 0MQ version 2.1:

(*Socket)GetRcvtimeo, (*Socket)GetSndtimeo, (*Socket)SetRcvtimeo, (*Socket)SetSndtimeo

http://www.zeromq.org/

See also the wiki (for zmq4): 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.

Index

Constants

View Source
const (

	// On Windows platform some of the standard POSIX errnos are not defined.
	EADDRINUSE      = Errno(C.EADDRINUSE)
	EADDRNOTAVAIL   = Errno(C.EADDRNOTAVAIL)
	ECONNREFUSED    = Errno(C.ECONNREFUSED)
	EINPROGRESS     = Errno(C.EINPROGRESS)
	ENETDOWN        = Errno(C.ENETDOWN)
	ENOBUFS         = Errno(C.ENOBUFS)
	ENOTSOCK        = Errno(C.ENOTSOCK)
	ENOTSUP         = Errno(C.ENOTSUP)
	EPROTONOSUPPORT = Errno(C.EPROTONOSUPPORT)

	// Native 0MQ error codes.
	EFSM           = Errno(C.EFSM)
	EMTHREAD       = Errno(C.EMTHREAD)
	ENOCOMPATPROTO = Errno(C.ENOCOMPATPROTO)
	ETERM          = Errno(C.ETERM)
)
View Source
const (
	// Constants for NewSocket()
	// See: http://api.zeromq.org/2-2: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)
)
View Source
const (
	// Flags for (*Socket)Send(), (*Socket)Recv()
	// For Send, see: http://api.zeromq.org/2-2:zmq-send#toc2
	// For Recv, see: http://api.zeromq.org/2-2:zmq-recv#toc2
	NOBLOCK = Flag(C.ZMQ_NOBLOCK)
	SNDMORE = Flag(C.ZMQ_SNDMORE)
)
View Source
const (
	// Flags for (*Socket)GetEvents()
	// See: http://api.zeromq.org/2-2:zmq-getsockopt#toc22
	POLLIN  = State(C.ZMQ_POLLIN)
	POLLOUT = State(C.ZMQ_POLLOUT)
)
View Source
const (
	// Constants for Device()
	// See: http://api.zeromq.org/2-2:zmq-device#toc2
	QUEUE     = Dev(C.ZMQ_QUEUE)
	FORWARDER = Dev(C.ZMQ_FORWARDER)
	STREAMER  = Dev(C.ZMQ_STREAMER)
)

Variables

View Source
var (
	ErrorContextClosed  = errors.New("Context is closed")
	ErrorSocketClosed   = errors.New("Socket is closed")
	ErrorNotImplemented = errors.New("Not implemented, requires 0MQ version 2.2")
	ErrorNoSocket       = errors.New("No such socket")
)

Functions

func Device

func Device(device Dev, frontend, backend *Socket) error

Start built-in ØMQ device

see: http://api.zeromq.org/2-2:zmq-device#toc2

func Error

func Error(e int) string

Get 0MQ error message string.

func GetIoThreads

func GetIoThreads() (int, error)

Returns the size of the 0MQ thread pool in the current default context.

func Proxy

func Proxy(frontend, backend, capture *Socket) error

Emulate the proxy that will be built-in in 0MQ version 3

See: http://api.zeromq.org/3-2:zmq-proxy

func SetIoThreads

func SetIoThreads(n int) error

This function specifies the size of the ØMQ 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 function creates a new default context without closing the old one. Use it before creating any sockets.

Default value: 1

func Term

func Term() error

Terminates the current default and all old default contexts.

For linger behavior, see: http://api.zeromq.org/2-2:zmq-term

func Version

func Version() (major, minor, patch int)

Report 0MQ library version.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

A context that is not the default context.

func NewContext

func NewContext(nr_of_threads int) (ctx *Context, err error)

Create a new context.

The argument specifies the size of the ØMQ 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.

func (*Context) GetIoThreads

func (ctx *Context) GetIoThreads() (int, error)

Returns the size of the 0MQ thread pool.

func (*Context) NewSocket

func (ctx *Context) NewSocket(t Type) (soc *Socket, err error)

Create 0MQ socket.

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/2-2:zmq-socket#toc3

func (*Context) Term

func (ctx *Context) Term() error

Terminates the context.

For linger behavior, see: http://api.zeromq.org/2-2:zmq-term

type Dev

type Dev int

Uses by Device()

func (Dev) String

func (d Dev) String() string

Dev as string

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.

func AsErrno

func AsErrno(err error) Errno

Convert error to Errno.

Example usage:

switch AsErrno(err) {

case zmq.Errno(syscall.EINTR):
    // standard system error

    // call was interrupted

case zmq.ETERM:
    // error defined by ZeroMQ

    // context was terminated

}

See also: examples/interrupt.go

func (Errno) Error

func (errno Errno) Error() string

Return Errno as string.

type Flag

type Flag int

Used by (*Socket)Send() and (*Socket)Recv()

func (Flag) String

func (f Flag) String() string

Socket flag as string.

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 NewPoller

func NewPoller() *Poller

Create a new Poller

func (*Poller) Add

func (p *Poller) Add(soc *Socket, events State) int

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

func (p *Poller) Poll(timeout time.Duration) ([]Polled, error)

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

func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error)

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

func (p *Poller) Remove(id int) error

Remove a socket from the poller

Returns ErrorNoSocket if the id was out of range

func (*Poller) RemoveBySocket

func (p *Poller) RemoveBySocket(soc *Socket) error

Remove a socket from the poller

Returns ErrorNoSocket if the socket didn't match

func (*Poller) String

func (p *Poller) String() string

Poller as string.

func (*Poller) Update

func (p *Poller) Update(id int, events State) (previous State, err error)

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

func (p *Poller) UpdateBySocket(soc *Socket, events State) (previous State, err error)

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

func (r *Reactor) AddSocket(soc *Socket, events State, handler func(State) error)

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

func (r *Reactor) RemoveChannel(id uint64)

Remove a channel from the reactor.

Closed channels are removed automatically.

func (*Reactor) RemoveSocket

func (r *Reactor) RemoveSocket(soc *Socket)

Remove a socket handler from the reactor.

func (*Reactor) Run

func (r *Reactor) Run(interval time.Duration) (err error)

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

func (r *Reactor) SetVerbose(verbose bool)

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

func NewSocket(t Type) (soc *Socket, err error)

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/2-2:zmq-socket#toc3

func (*Socket) Bind

func (soc *Socket) Bind(endpoint string) error

Accept incoming connections on a socket.

For a description of endpoint, see: http://api.zeromq.org/2-2:zmq-bind#toc2

func (*Socket) Close

func (soc *Socket) Close() error

If not called explicitly, the socket will be closed on garbage collection

func (*Socket) Connect

func (soc *Socket) Connect(endpoint string) error

Create outgoing connection from socket.

For a description of endpoint, see: http://api.zeromq.org/2-2:zmq-connect#toc2

func (*Socket) Context

func (soc *Socket) Context() (*Context, error)

Return the context associated with a socket

func (*Socket) GetAffinity

func (soc *Socket) GetAffinity() (uint64, error)

ZMQ_AFFINITY: Retrieve I/O thread affinity

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc9

func (*Socket) GetBacklog

func (soc *Socket) GetBacklog() (int, error)

ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc20

func (*Socket) GetEvents

func (soc *Socket) GetEvents() (State, error)

ZMQ_EVENTS: Retrieve socket event state

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc22

func (*Socket) GetFd

func (soc *Socket) GetFd() (int, error)

ZMQ_FD: Retrieve file descriptor associated with the socket

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc21

func (*Socket) GetHwm

func (soc *Socket) GetHwm() (uint64, error)

ZMQ_HWM: Retrieve high water mark

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc5

func (*Socket) GetIdentity

func (soc *Socket) GetIdentity() (string, error)

ZMQ_IDENTITY: Retrieve socket identity

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc10

func (*Socket) GetLinger

func (soc *Socket) GetLinger() (time.Duration, error)

ZMQ_LINGER: Retrieve linger period for socket shutdown

Returns time.Duration(-1) for infinite

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc17

func (*Socket) GetMcastLoop

func (soc *Socket) GetMcastLoop() (bool, error)

ZMQ_MCAST_LOOP: Control multicast loop-back

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc14

func (*Socket) GetRate

func (soc *Socket) GetRate() (int64, error)

ZMQ_RATE: Retrieve multicast data rate

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc11

func (*Socket) GetRcvbuf

func (soc *Socket) GetRcvbuf(value int) (uint64, error)

ZMQ_RCVBUF: Retrieve kernel receive buffer size

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc16

func (*Socket) GetRcvmore

func (soc *Socket) GetRcvmore() (bool, error)

ZMQ_RCVMORE: More message data parts to follow

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc4

func (*Socket) GetRcvtimeo

func (soc *Socket) GetRcvtimeo() (time.Duration, error)

ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN

Returns time.Duration(-1) for infinite

Returns ErrorNotImplemented in 0MQ version 2.1

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc6

func (*Socket) GetReconnectIvl

func (soc *Socket) GetReconnectIvl() (time.Duration, error)

ZMQ_RECONNECT_IVL: Retrieve reconnection interval

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc18

func (*Socket) GetReconnectIvlMax

func (soc *Socket) GetReconnectIvlMax() (time.Duration, error)

ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc19

func (*Socket) GetRecoveryIvl

func (soc *Socket) GetRecoveryIvl() (time.Duration, error)

ZMQ_RECOVERY_IVL: Get multicast recovery interval

Note: return time is time.Duration

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc12

func (*Socket) GetRecoveryIvlMsec

func (soc *Socket) GetRecoveryIvlMsec() (time.Duration, error)

ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds

Note: return time is time.Duration

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc13

func (*Socket) GetSndbuf

func (soc *Socket) GetSndbuf(value int) (uint64, error)

ZMQ_SNDBUF: Retrieve kernel transmit buffer size

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc15

func (*Socket) GetSndtimeo

func (soc *Socket) GetSndtimeo() (time.Duration, error)

ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN

Returns time.Duration(-1) for infinite

Returns ErrorNotImplemented in 0MQ version 2.1

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc7

func (*Socket) GetSwap

func (soc *Socket) GetSwap() (int64, error)

ZMQ_SWAP: Retrieve disk offload size

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc8

func (*Socket) GetType

func (soc *Socket) GetType() (Type, error)

ZMQ_TYPE: Retrieve socket type

See: http://api.zeromq.org/2-2:zmq-getsockopt#toc3

func (*Socket) Recv

func (soc *Socket) Recv(flags Flag) (string, error)

Receive a message part from a socket.

For a description of flags, see: http://api.zeromq.org/2-2:zmq-recv#toc2

func (*Socket) RecvBytes

func (soc *Socket) RecvBytes(flags Flag) ([]byte, error)

Receive a message part from a socket.

For a description of flags, see: http://api.zeromq.org/2-2:zmq-recv#toc2

func (*Socket) RecvMessage

func (soc *Socket) RecvMessage(flags Flag) (msg []string, err error)

Receive parts as message from socket.

Returns last non-nil error code.

func (*Socket) RecvMessageBytes

func (soc *Socket) RecvMessageBytes(flags Flag) (msg [][]byte, err error)

Receive parts as message from socket.

Returns last non-nil error code.

func (*Socket) Send

func (soc *Socket) Send(data string, flags Flag) (int, error)

Send a message part on a socket.

For a description of flags, see: http://api.zeromq.org/2-2:zmq-send#toc2

func (*Socket) SendBytes

func (soc *Socket) SendBytes(data []byte, flags Flag) (int, error)

Send a message part on a socket.

For a description of flags, see: http://api.zeromq.org/2-2:zmq-send#toc2

func (*Socket) SendMessage

func (soc *Socket) SendMessage(parts ...interface{}) (total int, err error)

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

func (soc *Socket) SendMessageDontwait(parts ...interface{}) (total int, err error)

Like SendMessage(), but adding the NOBLOCK flag.

func (*Socket) SetAffinity

func (soc *Socket) SetAffinity(value uint64) error

ZMQ_AFFINITY: Set I/O thread affinity

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc5

func (*Socket) SetBacklog

func (soc *Socket) SetBacklog(value int) error

ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc20

func (*Socket) SetHwm

func (soc *Socket) SetHwm(value uint64) error

ZMQ_HWM: Set high water mark

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc3

func (*Socket) SetIdentity

func (soc *Socket) SetIdentity(value string) error

ZMQ_IDENTITY: Set socket identity

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc6

func (*Socket) SetLinger

func (soc *Socket) SetLinger(value time.Duration) error

ZMQ_LINGER: Set linger period for socket shutdown

Use -1 for infinite

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc17

func (*Socket) SetMcastLoop

func (soc *Socket) SetMcastLoop(value bool) error

ZMQ_MCAST_LOOP: Control multicast loop-back

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc14

func (*Socket) SetRate

func (soc *Socket) SetRate(value int64) error

ZMQ_RATE: Set multicast data rate

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc11

func (*Socket) SetRcvbuf

func (soc *Socket) SetRcvbuf(value uint64) error

ZMQ_RCVBUF: Set kernel receive buffer size

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc16

func (*Socket) SetRcvtimeo

func (soc *Socket) SetRcvtimeo(value time.Duration) error

ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN

Use -1 for infinite

Returns ErrorNotImplemented in 0MQ version 2.1

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc9

func (*Socket) SetReconnectIvl

func (soc *Socket) SetReconnectIvl(value time.Duration) error

ZMQ_RECONNECT_IVL: Set reconnection interval

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc18

func (*Socket) SetReconnectIvlMax

func (soc *Socket) SetReconnectIvlMax(value time.Duration) error

ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc19

func (*Socket) SetRecoveryIvl

func (soc *Socket) SetRecoveryIvl(value time.Duration) error

ZMQ_RECOVERY_IVL: Set multicast recovery interval

Note: value is of type time.Duration

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc12

func (*Socket) SetRecoveryIvlMsec

func (soc *Socket) SetRecoveryIvlMsec(value time.Duration) error

ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds

Note: value is of type time.Duration

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc13

func (*Socket) SetSndbuf

func (soc *Socket) SetSndbuf(value uint64) error

ZMQ_SNDBUF: Set kernel transmit buffer size

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc15

func (*Socket) SetSndtimeo

func (soc *Socket) SetSndtimeo(value time.Duration) error

ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN

Use -1 for infinite

Returns ErrorNotImplemented in 0MQ version 2.1

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc10

func (*Socket) SetSubscribe

func (soc *Socket) SetSubscribe(filter string) error

ZMQ_SUBSCRIBE: Establish message filter

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc7

func (*Socket) SetSwap

func (soc *Socket) SetSwap(value int64) error

ZMQ_SWAP: Set disk offload size

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc4

func (*Socket) SetUnsubscribe

func (soc *Socket) SetUnsubscribe(filter string) error

ZMQ_UNSUBSCRIBE: Remove message filter

See: http://api.zeromq.org/2-2:zmq-setsockopt#toc8

func (Socket) String

func (soc Socket) String() string

Socket as string.

type State

type State uint32

Used by (soc *Socket)GetEvents()

func (State) String

func (s State) String() string

Socket state as string.

type Type

type Type int

Specifies the type of a socket, used by NewSocket()

func (Type) String

func (t Type) String() string

Socket type as string.

Directories

Path Synopsis
examples module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL