Sha256: 5a934d20a4287f94c0c306d295b90f3d509058454240bfba9e6305cf80ccf1c2

Contents?: true

Size: 560 Bytes

Versions: 5

Compression:

Stored size: 560 Bytes

Contents

#!/usr/bin/env ruby
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
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

5 entries across 5 versions & 1 rubygems

Version Path
websocket-client-simple-0.9.0 sample/client.rb
websocket-client-simple-0.8.0 sample/client.rb
websocket-client-simple-0.7.0 sample/client.rb
websocket-client-simple-0.6.1 sample/client.rb
websocket-client-simple-0.6.0 sample/client.rb