Sha256: 2a14973f2a017fc439c648c4cf1cbce7443643fd0003af1b081cc40d1cc7a9a9

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 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|
    next if err
    puts "> #{tuple.data.msg} (from:#{tuple.from})"
  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

2 entries across 2 versions & 1 rubygems

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