% gem install linda-socket.io-client
require 'rubygems'
require 'linda-socket.io-client'
linda = Linda::SocketIO::Client.connect 'http://node-linda-base.herokuapp.com'
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
linda.io.on :error do |err|
p err
end
while line = STDIN.gets
line.strip!
next if line.empty?
ts.write(type: "chat", msg: line, at: Time.now)
end
% gem install bundler
% bundle install
% npm install
% bundle exec rake test