Sha256: 2d0976659542e377eeb7046b37171528a7b8b3fcb14b6b804623ca83f3ba82b7
Contents?: true
Size: 662 Bytes
Versions: 3
Compression:
Stored size: 662 Bytes
Contents
#!/usr/bin/env ruby $:.unshift File.expand_path '../lib', File.dirname(__FILE__) require 'rubygems' require 'em-cometio-client' name = `whoami`.strip || 'shokai' url = ARGV.shift || 'http://localhost:5000/cometio/io' EM::run do client = EM::CometIO::Client.new(url).connect client.on :connect do |session| puts "connect!! (sessin_id:#{session})" end client.on :chat do |data| puts "<#{data['name']}> #{data['message']}" end client.on :error do |err| STDERR.puts err end EM::defer do loop do line = STDIN.gets.strip next if line.empty? client.push :chat, {:message => line, :name => name} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
em-cometio-client-0.1.1 | sample/cui_chat_client.rb |
em-cometio-client-0.1.0 | sample/cui_chat_client.rb |
em-cometio-client-0.0.7 | sample/cui_chat_client.rb |