Class: RJR::Nodes::WebConnection

Inherits:
EventMachine::Connection
  • Object
show all
Includes:
EventMachine::HttpServer
Defined in:
lib/rjr/nodes/web.rb

Overview

Helper class intialized by eventmachine encapsulating a http connection

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ WebConnection

WebConnection initializer.

specify the web node establishing the connection



46
47
48
49
# File 'lib/rjr/nodes/web.rb', line 46

def initialize(args = {})
  super
  @rjr_node = args[:rjr_node]
end

Instance Method Details

#process_http_requestObject

EventMachine::Connection#process_http_request callback, handle request messages



52
53
54
55
56
57
58
59
60
61
# File 'lib/rjr/nodes/web.rb', line 52

def process_http_request
  # TODO support http protocols other than POST
  msg = @http_post_content.nil? ? '' : @http_post_content
  @rjr_node.send(:handle_message, msg, self) # XXX private method

  # XXX we still have to send a response back to client to satisfy 
  # the http standard, even if this is a notification. handle_message
  # does not do this.
  @rjr_node.send_msg "", self if Messages::Notification.is_notification_message?(msg)
end