Websocketd: `-l host` parameter
parent
115e6f5b0a
commit
1495728777
|
@ -37,9 +37,14 @@ class WrappedTCPFileDescriptor < TCPSocket
|
|||
end
|
||||
|
||||
service_name = "websocket"
|
||||
host = "0.0.0.0"
|
||||
port_to_listen = 1234
|
||||
|
||||
OptionParser.parse! do |parser|
|
||||
parser.on "-l host", "--l host", "IP address to listen on." do |h|
|
||||
host = h
|
||||
end
|
||||
|
||||
parser.on "-p port", "--port port", "Port to listen on." do |port|
|
||||
port_to_listen = port.to_u16
|
||||
end
|
||||
|
@ -111,7 +116,7 @@ class InstanceStorage
|
|||
end
|
||||
|
||||
# by default, listen on any IP address
|
||||
server = TCPServer.new("0.0.0.0", port_to_listen)
|
||||
server = TCPServer.new(host, port_to_listen)
|
||||
service = IPC::SwitchingService.new service_name
|
||||
service << server.fd
|
||||
context = InstanceStorage.new service
|
||||
|
|
Reference in New Issue