Sha256: c56e313787548d85dfd4170be50557fb656fe397ba5f1f324ae52df44efdb2a7
Contents?: true
Size: 571 Bytes
Versions: 17
Compression:
Stored size: 571 Bytes
Contents
require 'rubygems' require 'bundler/setup' $:.unshift File.expand_path '../../lib', File.dirname(__FILE__) require 'sinatra/cometio/client' name = `whoami`.strip || 'shokai' client = CometIO::Client.new('http://localhost:5000/cometio/io').connect client.on :connect do |session| puts "connect!! (session_id:#{session})" end client.on :chat do |data| puts "<#{data['name']}> #{data['message']}" end client.on :error do |err| STDERR.puts err end loop do line = STDIN.gets.strip next if line.empty? client.push :chat, {:message => line, :name => name} end
Version data entries
17 entries across 17 versions & 1 rubygems