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