Sha256: c4ddb233631a8e094d1b188e19fc69a9e78f4ee199d8c33e64870d941f8c643d

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

require 'aggro/zeromq_transport/client'
require 'aggro/zeromq_transport/publisher'
require 'aggro/zeromq_transport/server'
require 'aggro/zeromq_transport/subscriber'

module Aggro
  # Public: Transport layer over nanomsg sockets.
  module ZeroMQTransport
    class << self
      attr_writer :linger
    end

    module_function

    def client(endpoint)
      Client.new endpoint
    end

    def context
      @context ||= ZeroMQ::Context.new
    end

    def linger
      @linger ||= 1_000
    end

    def publisher(endpoint)
      Publisher.new endpoint
    end

    def server(endpoint, callable = nil, &block)
      Server.new endpoint, callable, &block
    end

    def subscriber(endpoint, callable = nil, &block)
      Subscriber.new endpoint, callable, &block
    end

    def teardown
      @context.terminate if @context
      @context = nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aggro-0.0.4 lib/aggro/zeromq_transport.rb