diff --git a/src/websocketd.cr b/src/websocketd.cr index 0efb159..61e37fb 100644 --- a/src/websocketd.cr +++ b/src/websocketd.cr @@ -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