Sha256: d8a3ae2a1025ef2d87c0553b10d9a139b69081bed6bfdf4edb69d0c27387cac1
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
require 'rubygems' require 'bundler/setup' $:.unshift File.expand_path '../../lib', File.dirname(__FILE__) require 'sinatra/cometio/client' name = `whoami`.strip || 'shokai' client = Sinatra::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-cometio-0.4.0 | sample/bin/cui_chat_client.rb |