Sha256: 824fd84a4b3497411cb168b7a456063c516ca0bdabc5ddad4141a1ec2d5df7d0

Contents?: true

Size: 799 Bytes

Versions: 18

Compression:

Stored size: 799 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
$:.unshift File.expand_path '../../lib', File.dirname(__FILE__)
require 'sinatra/rocketio/client'

name = `whoami`.strip || 'shokai'
url = ARGV.shift || 'http://localhost:5000'
type = ARGV.shift || :websocket

io = Sinatra::RocketIO::Client.new(url, :type => type, :channel => "1").connect
#io = Sinatra::RocketIO::Client.new('http://localhost:5000', :type => :comet).connect

io.on :connect do
  puts "#{io.type} connect!! (session_id:#{io.session})"
end

io.on :chat do |data|
  puts "<#{data['name']}> #{data['message']}"
end

io.on :error do |err|
  STDERR.puts err
end

io.on :disconnect do
  puts "disconnected!!"
end

loop do
  line = STDIN.gets.strip
  next if line.empty?
  io.push :chat, {:message => line, :name => name}
end

Version data entries

18 entries across 11 versions & 1 rubygems

Version Path
sinatra-rocketio-0.3.3 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.3 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.2 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.2 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.1 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.1 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.0 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.3.0 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.6 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.6 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.5 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.5 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.4 sample/modular_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.4 sample/classic_style/bin/cui_chat_client.rb
sinatra-rocketio-0.2.3 sample/bin/cui_chat_client.rb
sinatra-rocketio-0.2.2 sample/bin/cui_chat_client.rb
sinatra-rocketio-0.2.1 sample/bin/cui_chat_client.rb
sinatra-rocketio-0.2.0 sample/bin/cui_chat_client.rb