lib/hara/server.rb in hara-0.0.2 vs lib/hara/server.rb in hara-0.1.0
- old
+ new
@@ -1,6 +1,7 @@
require 'reel'
+require 'hara/base'
module Hara
class Server < Reel::Server
include Celluloid::Logger
@@ -14,19 +15,19 @@
case request
when Reel::WebSocket
info "Received a WebSocket connection"
handle_websocket request
when Reel::Request
- warn "Not support normal connection"
- handle_request connection, request
+ Hara.request_handler.call connection, request
else
- warn "Not support normal connection"
+ warn "Connection not support"
request.close
end
end
end
- def handle_request connection, request
+ Hara.request_handler do |connection, request|
+ info "#{request.remote_ip} request #{request.url}, not support"
request.close
end
def handle_websocket socket
Hara::Application.new socket