Sha256: f4930a0fae84e23221a205f33cd3f15763362ff3142a20bde2e398a4bac31bf6
Contents?: true
Size: 576 Bytes
Versions: 3
Compression:
Stored size: 576 Bytes
Contents
$:.unshift File.expand_path '../lib', File.dirname(__FILE__) require 'rubygems' require 'socket.io-client-simple' socket = SocketIO::Client::Simple.connect 'http://localhost:3000' #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 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
socket.io-client-simple-0.0.4 | samples/sample.rb |
socket.io-client-simple-0.0.3 | samples/sample.rb |
socket.io-client-simple-0.0.2 | samples/sample.rb |