Sha256: 09776d279212498fbb81bf59320a82f779ca1e49e299b707e7f10db5ffca9c5d
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# SocketIO::Client::Simple A simple ruby client for node.js's socket.io. 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 socket.io-client-simple ## 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' 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 ``` sample.rb works with [samples/chat_server.js](https://github.com/shokai/ruby-socket.io-client-simple/blob/master/samples/chat_server.js). ### start chat server % npm install % node samples/chat_server.js => 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-0.0.4 | README.md |
socket.io-client-simple-0.0.3 | README.md |