Sha256: 1ab874e2f0134d19135bab729fdb023bfb693561d09990f691ef294aee6847e7
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 KB
Contents
# SocketIO::Client::Simple A simple ruby client for Node.js's Socket.IO v1.3.x, Supports only WebSocket. - https://github.com/shokai/ruby-socket.io-client-simple - https://rubygems.org/gems/socket.io-client-simple [](https://travis-ci.org/shokai/ruby-socket.io-client-simple) ## Install gem install % gem install socket.io-client-simple # latest version, supports Socket.IO v1.3.x or use `Gemfile` with Bundler gem 'socket.io-client-simple', '< 1.0' # for Socket.IO v0.9.x gem 'socket.io-client-simple' # for Socket.IO v1.3.x ## Usage [samples/sample.rb](https://github.com/shokai/ruby-socket.io-client-simple/blob/master/samples/sample.rb) ```ruby require 'rubygems' require 'socket.io-client-simple' socket = SocketIO::Client::Simple.connect 'http://localhost:3000' ## connect with parameter socket = SocketIO::Client::Simple.connect 'http://localhost:3000', :foo => "bar" 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 ``` sample.rb works with [samples/chat_server.coffee](https://github.com/shokai/ruby-socket.io-client-simple/blob/master/samples/chat_server.coffee). ### start chat server % npm install % coffee samples/chat_server.coffee => chat server start at localhost:3000 ### ruby sample.rb % ruby samples/sample.rb ## Test % gem install bundler % bundle install % npm install % bundle exec rake test ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
socket.io-client-simple-1.2.0 | README.md |
socket.io-client-simple-1.1.3 | README.md |