Module: SocketIO

Defined in:
lib/socketio-client.rb

Defined Under Namespace

Classes: Client

Class Method Summary collapse

Class Method Details

.connect(host, options = {}, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/socketio-client.rb', line 8

def self.connect(host, options = {}, &block)
  response = RestClient.get "http://#{host}/socket.io/1/"
  # resonse should be in the form of sessionid:heartbeattimeout:closetimeout:supported stuff
  response_array = response.split(':')
  response_array = [host] + response_array << options
  cli = Client.new(*response_array)
  cli.instance_eval(&block) if block
  cli.start
end