Sha256: e112a85fca08037d42e8e2d1792698a21d51ead0d499115754c32fb90203b4a5
Contents?: true
Size: 711 Bytes
Versions: 2
Compression:
Stored size: 711 Bytes
Contents
$:.unshift File.expand_path '../lib', File.dirname(__FILE__) require 'rubygems' require 'statscloud.io-ruby-socket.io-client-simple' url = ARGV.shift || 'http://localhost:3000' socket = StatsCloudIO::SocketIO::Client::Simple.connect url # socket.auto_reconnection = false #socket.websocket.on :message do |msg| ## inspect websocket data # p msg.data #end socket.on :connect do puts "connect!!!" end socket.on :disconnect do puts "disconnected!!" end socket.on :chat do |data| puts "> " + data['msg'] end socket.on :error do |err| p err end puts "please input and press Enter key" loop do msg = STDIN.gets.strip next if msg.empty? socket.emit :chat, {:msg => msg, :at => Time.now} end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
statscloud.io-ruby-socket.io-client-simple-1.2.1.pre.3 | samples/sample.rb |
statscloud.io-ruby-socket.io-client-simple-1.2.1.pre.2 | samples/sample.rb |