Sha256: 02c1124eb0393d71ea1ccbaf5356e3366f1f3895c1b24b2d468ab7a8e763f3e2

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

#!/usr/bin/env ruby
require "rubygems"
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'em-rocketio-linda-client'

url = ARGV.empty? ? "http://linda.shokai.org" : ARGV.shift

EM::run do
  client = EM::RocketIO::Linda::Client.new url
  ts = client.tuplespace["test_spae"]

  client.io.on :connect do
    puts "connect #{client.io.type} (#{client.io.session})"
    ts.write [1,2,3]
    ts.write [1,2,3,4]
    ts.write [1,2,3,4,"abc"]

    EM::defer do
      loop do
        tuple = ts.take [1,2]
        puts "blocking take #{tuple}"
      end
    end

    EM::add_periodic_timer 1 do
      ts.write [1,2, Time.now]
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-rocketio-linda-client-1.1.0 sample/sample_blocking.rb
em-rocketio-linda-client-1.0.0 sample/sample_blocking.rb