Sha256: 5c4e64eef26caf267e03f47f7610d6fb232f5f91f55d3c9715a7b8de5170c625

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

# encoding: utf-8

# Durable subscriber to be used in conjunction with durable_pub.rb
# Justin Case <justin@playelite.com>

require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rxs')

context = XS::Context.create()

# Connect our subscriber socket
subscriber = context.socket(XS::SUB)
subscriber.setsockopt(XS::IDENTITY, "Hello")
subscriber.setsockopt(XS::SUBSCRIBE, "")
subscriber.connect("tcp://127.0.0.1:5565")

# Synchronize with publisher
sync = context.socket(XS::PUSH)
sync.connect("tcp://127.0.0.1:5564")
sync.send_string("")

# Get updates, exit when told to do so
loop do
  subscriber.recv_string(message = '')
  puts "Received: " + message
  if message == "END"
    break
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-rxs-1.2.1 examples/durable_sub.rb
ffi-rxs-1.2.0 examples/durable_sub.rb
ffi-rxs-1.1.0 examples/durable_sub.rb
ffi-rxs-1.0.1 examples/durable_sub.rb