Sha256: f0b43f507f262b514c299ae6f8623df189e56d146dd60c34caa79172c5d3993b

Contents?: true

Size: 721 Bytes

Versions: 8

Compression:

Stored size: 721 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'faye/websocket'
require 'eventmachine'
require 'permessage_deflate'

EM.run {
  url   = ARGV[0]
  proxy = ARGV[1]

  ws = Faye::WebSocket::Client.new(url, [],
    :proxy      => {:origin => proxy, :headers => {'User-Agent' => 'Echo'}},
    :headers    => {'Origin' => 'http://faye.jcoglan.com'},
    :extensions => [PermessageDeflate]
  )

  ws.onopen = lambda do |event|
    p [:open, ws.headers]
    ws.send('mic check')
  end

  ws.onclose = lambda do |close|
    p [:close, close.code, close.reason]
    EM.stop
  end

  ws.onerror = lambda do |error|
    p [:error, error.message]
  end

  ws.onmessage = lambda do |message|
    p [:message, message.data]
  end
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
faye-websocket-0.10.7 examples/client.rb
faye-websocket-0.10.6 examples/client.rb
faye-websocket-0.10.5 examples/client.rb
faye-websocket-0.10.4 examples/client.rb
faye-websocket-0.10.3 examples/client.rb
faye-websocket-0.10.2 examples/client.rb
faye-websocket-0.10.1 examples/client.rb
faye-websocket-0.10.0 examples/client.rb