Class: Thrift::ThinHTTPServer

Inherits:
BaseServer show all
Defined in:
lib/thrift/server/thin_http_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(processor, options = {}) ⇒ ThinHTTPServer

Accepts a Thrift::Processor Options include:

  • :port

  • :ip

  • :path

  • :protocol_factory



36
37
38
39
40
41
42
43
# File 'lib/thrift/server/thin_http_server.rb', line 36

def initialize(processor, options={})
  port = options[:port] || 80
  ip = options[:ip] || "0.0.0.0"
  path = options[:path] || "/"
  protocol_factory = options[:protocol_factory] || BinaryProtocolFactory.new
  app = RackApplication.for(path, processor, protocol_factory)
  @server = Thin::Server.new(ip, port, app)
end

Instance Method Details

#serveObject

Starts the server



47
48
49
# File 'lib/thrift/server/thin_http_server.rb', line 47

def serve
  @server.start
end