class Server::EventServer

The actual EM::Connection instance referenced by the EventServer class. Notice that we use Mysql2::Client::EM instead of the regular Mysql2::Client class.

Public Instance Methods

receive_data(data) click to toggle source

Take the raw data received on @port and run initiate the checks against the server located at @server

Special conditions

We are sending something to our client with send_data inside the function, depending on what run_checks returned to us during the function call.

Attributes

  • data - We receive the actual HTTP request but since we’re not a full blown HTTP server we don’t actually use it to any extent

# File lib/apprentice/server.rb, line 33
def receive_data(data)
  response = run_checks
  response_text = format_text(response[:text])
  send_data generate_response(response[:code], response_text)
end