Sha256: 08d4cd27d800762826621a8eb1cf5efb30f38e71de303e39cff6c2834e447d90

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'rubygems'
require 'linda-socket.io-client'

linda = Linda::SocketIO::Client.connect 'http://localhost:3000'
ts = linda.tuplespace('test')

linda.io.on :connect do
  puts "connect!! #{linda.url}"

  ts.watch type: "chat" do |err, tuple|
    msg = tuple["data"]["msg"]
    puts "> #{msg}"
  end
end

linda.io.on :disconnect do
  puts "disconnect"
end

while line = STDIN.gets
  line.strip!
  next if line.empty?
  ts.write(type: "chat", msg: line, at: Time.now)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linda-socket.io-client-0.0.1 samples/sample.rb