Class: CZTop::Socket::PUB

Inherits:
CZTop::Socket show all
Includes:
Writable
Defined in:
lib/cztop/socket/pub.rb

Overview

Publish socket for the ZeroMQ Publish-Subscribe Pattern.

Constant Summary

Constants included from FdWait

FdWait::FD_TIMEOUT, FdWait::JIFFY

Constants inherited from CZTop::Socket

TypeNames

Constants included from CZMQ::FFI

CZMQ::FFI::CZMQ_VERSION, CZMQ::FFI::ZFRAME_DONTWAIT, CZMQ::FFI::ZFRAME_MORE, CZMQ::FFI::ZMONITOR_FN, CZMQ::FFI::ZMQ_VERSION

Constants included from ZsockOptions

ZsockOptions::POLLIN, ZsockOptions::POLLOUT

Instance Attribute Summary

Attributes inherited from CZTop::Socket

#last_tcp_port

Attributes included from HasFFIDelegate

#ffi_delegate

Instance Method Summary collapse

Methods included from Writable

#send, #wait_writable

Methods included from FdWait

#wait_for_fd_signal, #wait_for_socket_state

Methods inherited from CZTop::Socket

bind, #bind, #close, #connect, connect, #disconnect, #inspect, #last_endpoint, #set_unbounded, #unbind

Methods included from HasFFIDelegate::ClassMethods

#ffi_delegate, #from_ffi_delegate

Methods included from ZsockOptions

#conflate=, #conflate?, #fd, #heartbeat_ivl, #heartbeat_ivl=, #heartbeat_timeout, #heartbeat_timeout=, #heartbeat_ttl, #heartbeat_ttl=, #identity, #identity=, #immediate=, #immediate?, #ipv6=, #ipv6?, #linger, #linger=, #max_msg_size, #max_msg_size=, #rcvhwm, #rcvhwm=, #readable?, #reconnect_ivl, #reconnect_ivl=, #reconnect_ivl_max, #reconnect_ivl_max=, #recv_timeout, #recv_timeout=, #router_mandatory=, #router_mandatory?, #send_timeout, #send_timeout=, #sndhwm, #sndhwm=, #tcp_keepalive, #tcp_keepalive=, #tcp_keepalive_cnt, #tcp_keepalive_cnt=, #tcp_keepalive_idle, #tcp_keepalive_idle=, #tcp_keepalive_intvl, #tcp_keepalive_intvl=, #to_io, #tos, #tos=, #writable?

Methods included from HasFFIDelegate

#attach_ffi_delegate, #from_ffi_delegate, raise_zmq_err, #to_ptr

Constructor Details

#initialize(endpoints = nil, curve: nil, linger: 0) ⇒ PUB

Returns a new instance of PUB.

Parameters:

  • endpoints (String) (defaults to: nil)

    endpoints to bind to

  • curve (Hash, nil) (defaults to: nil)

    CURVE encryption options

  • linger (Integer) (defaults to: 0)

    linger period in milliseconds (default: 0)



17
18
19
20
21
22
23
24
# File 'lib/cztop/socket/pub.rb', line 17

def initialize(endpoints = nil, curve: nil, linger: 0)
  super

  attach_ffi_delegate(Zsock.new(Types::PUB))
  self.linger = linger
  _apply_curve(curve)
  _attach(endpoints, default: :bind)
end