Sha256: 90a42faa8c3521eb6ff7bc9a5cb05a32be9f3b82c4a154fc35640cffbcde175c

Contents?: true

Size: 579 Bytes

Versions: 13

Compression:

Stored size: 579 Bytes

Contents

#!/usr/bin/env ruby
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'rubygems'
require 'websocket-client-simple'

puts "websocket-client-simple v#{WebSocket::Client::Simple::VERSION}"

url = ARGV.shift || 'ws://localhost:8080'

ws = WebSocket::Client::Simple.connect url

ws.on :message do |msg|
  puts ">> #{msg.data}"
end

ws.on :open do
  puts "-- websocket open (#{ws.url})"
end

ws.on :close do |e|
  puts "-- websocket close (#{e.inspect})"
  exit 1
end

ws.on :error do |e|
  puts "-- error (#{e.inspect})"
end

loop do
  ws.send STDIN.gets.strip
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
websocket-client-simple-0.5.1 sample/client.rb
websocket-client-simple-0.5.0 sample/client.rb
websocket-client-simple-0.4.0 sample/client.rb
websocket-client-simple-0.3.1 sample/client.rb
websocket-client-simple-0.3.0 sample/client.rb
websocket-client-simple-0.2.5 sample/client.rb
websocket-client-simple-0.2.4 sample/client.rb
websocket-client-simple-0.2.3 sample/client.rb
websocket-client-simple-0.2.2 sample/client.rb
websocket-client-simple-0.2.1 sample/client.rb
websocket-client-simple-0.2.0 sample/client.rb
websocket-client-simple-0.1.0 sample/client.rb
websocket-client-simple-0.0.9 sample/client.rb