Module: Rubarb::IncomingHandler

Includes:
ConnectionId
Defined in:
lib/rubarb/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConnectionId

#complete_id?, #extract_id

Instance Attribute Details

#apiObject

Returns the value of attribute api.



15
16
17
# File 'lib/rubarb/connection.rb', line 15

def api
  @api
end

#idObject

Returns the value of attribute id.



13
14
15
# File 'lib/rubarb/connection.rb', line 13

def id
  @id
end

#insecure_methodsObject

Returns the value of attribute insecure_methods.



16
17
18
# File 'lib/rubarb/connection.rb', line 16

def insecure_methods
  @insecure_methods
end

#on_connectionObject

Returns the value of attribute on_connection.



14
15
16
# File 'lib/rubarb/connection.rb', line 14

def on_connection
  @on_connection
end

#parentObject

Returns the value of attribute parent.



17
18
19
# File 'lib/rubarb/connection.rb', line 17

def parent
  @parent
end

Instance Method Details

#call_errbacks(message) ⇒ Object



43
44
45
# File 'lib/rubarb/connection.rb', line 43

def call_errbacks(message)
  @parent.call_errbacks(message)
end

#connection_completedObject



23
24
25
26
27
28
# File 'lib/rubarb/connection.rb', line 23

def connection_completed
  Rubarb::FastMessageProtocol.install(self)
  send_data("5")
  send_data(@id)
  @parent.connection_completed(self) if @parent
end

#post_initObject



19
20
21
# File 'lib/rubarb/connection.rb', line 19

def post_init
  @buffer = ""
end

#receive_message(message) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/rubarb/connection.rb', line 30

def receive_message message
  if (message == @id)
    self.extend(Rubarb::IncomingConnection)
    @on_connection.call if @on_connection
  else
    call_errbacks(ConnectionError.new("Handshake Failure"))
  end
end

#unbindObject



39
40
41
# File 'lib/rubarb/connection.rb', line 39

def unbind
  @parent.connection_closed(self)
end