Sha256: 9e2ffc6565fc5847ab76114dfd81f862f730b55acc3dad6325a010085b999b4f

Contents?: true

Size: 910 Bytes

Versions: 4

Compression:

Stored size: 910 Bytes

Contents

require 'rubyfox/client'

unless ARGV.size == 3
  abort "usage: #{$0} username password zone"
end

unless ENV['SF_DIR']
  abort "Point SF_DIR to your SmartFox installation"
end

Rubyfox::Client.require_libs(ENV['SF_DIR'] + "/lib")
Rubyfox::Client.boot!

Rubyfox::Client.new(:debug => true) do |client|
  client.on_event :connection do
    client.send :login, *ARGV
  end

  client.on_event :connection_attempt_http, :connection_resume, :connection_retry do |event|
  end

  client.on_event :login do |event|
    p :login => event
    client.send_extension "KeepAlive"
  end

  client.on_event :login_error, :connection_lost, :logout do |event|
    p :out => event
    client.exit
  end

  client.on_extension "KeepAlive" do |request|
    client.disconnect
  end

  client.on_event :any do |event|
    p :any_event => event
  end

  client.on_extension :any do |request|
    p :any_request => request
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubyfox-client-0.3.0-java examples/any.rb
rubyfox-client-0.3.0.pre2-java examples/any.rb
rubyfox-client-0.3.0.pre1-java examples/any.rb
rubyfox-client-0.2.0-java examples/any.rb