comparison net/http/server/server.rb @ 0:1eef88068f9f tip

initial commit of maze game source
author ferencd
date Sun, 15 Sep 2019 11:46:47 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1eef88068f9f
1 require 'net/http/server/daemon'
2
3 require 'net/protocol'
4
5 module Net
6 class HTTP < Protocol
7 module Server
8 #
9 # Starts the HTTP Server.
10 #
11 # @param [Hash] options
12 # Options for the server.
13 #
14 # @option options [String] :host (DEFAULT_HOST)
15 # The host to run on.
16 #
17 # @option options [String] :port (DEFAULT_PORT)
18 # The port to listen on.
19 #
20 # @option options [Integer] :max_connections (MAX_CONNECTIONS)
21 # The maximum number of simultaneous connections.
22 #
23 # @option options [Boolean] :background (false)
24 # Specifies whether to run the server in the background or
25 # foreground.
26 #
27 # @option options [#call] :handler
28 # The HTTP Request Handler object.
29 #
30 # @yield [request, socket]
31 # If a block is given, it will be used to process HTTP Requests.
32 #
33 # @yieldparam [Hash{Symbol => String,Array,Hash}] request
34 # The HTTP Request.
35 #
36 # @yieldparam [TCPSocket] socket
37 # The TCP socket of the client.
38 #
39 def Server.run(options={},&block)
40 daemon = Daemon.new(options,&block)
41
42 daemon.start
43 daemon.join unless options[:background]
44 return daemon
45 end
46
47 end
48 end
49 end