diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 821724cb..2fb37db9 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -19,4 +19,4 @@ WORKDIR ws RUN ["sh", "docker_build.sh"] EXPOSE 8765 -CMD ["/ws/ws", "transfer", "8765"] +CMD ["/ws/ws", "transfer", "--port", "8765", "--hostname", "0.0.0.0"] diff --git a/ws/docker_build.sh b/ws/docker_build.sh index 5b2f52e8..049ad66e 100644 --- a/ws/docker_build.sh +++ b/ws/docker_build.sh @@ -13,6 +13,7 @@ g++ --std=c++14 \ ../ixwebsocket/IXSocket.cpp \ ../ixwebsocket/IXSocketServer.cpp \ ../ixwebsocket/IXSocketConnect.cpp \ + ../ixwebsocket/IXSocketFactory.cpp \ ../ixwebsocket/IXDNSLookup.cpp \ ../ixwebsocket/IXCancellationRequest.cpp \ ../ixwebsocket/IXWebSocket.cpp \ @@ -22,12 +23,16 @@ g++ --std=c++14 \ ../ixwebsocket/IXWebSocketPerMessageDeflate.cpp \ ../ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp \ ../ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp \ + ../ixwebsocket/IXWebSocketHttpHeaders.cpp \ + ../ixwebsocket/IXHttpClient.cpp \ + ../ixwebsocket/IXUrlParser.cpp \ ../ixwebsocket/IXSocketOpenSSL.cpp \ ../ixwebsocket/linux/IXSetThreadName_linux.cpp \ - ../third_party/jsoncpp/jsoncpp.cpp \ + ../third_party/msgpack11/msgpack11.cpp \ ixcrypto/IXBase64.cpp \ ixcrypto/IXHash.cpp \ ixcrypto/IXUuid.cpp \ + ws_http_client.cpp \ ws_ping_pong.cpp \ ws_broadcast_server.cpp \ ws_echo_server.cpp \ diff --git a/ws/ws.cpp b/ws/ws.cpp index 21b2fad5..be51be09 100644 --- a/ws/ws.cpp +++ b/ws/ws.cpp @@ -31,6 +31,7 @@ int main(int argc, char** argv) std::string data; std::string headers; std::string output; + std::string hostname; bool headersOnly = false; bool followRedirects = false; bool verbose = false; @@ -63,6 +64,7 @@ int main(int argc, char** argv) CLI::App* broadcastServerApp = app.add_subcommand("broadcast_server", "Broadcasting server"); broadcastServerApp->add_option("--port", port, "Connection url"); + broadcastServerApp->add_option("--hostname", hostname, "Hostname"); CLI::App* pingPongApp = app.add_subcommand("ping", "Ping pong"); pingPongApp->add_option("url", url, "Connection url")->required(); @@ -113,7 +115,7 @@ int main(int argc, char** argv) } else if (app.got_subcommand("broadcast_server")) { - return ix::ws_broadcast_server_main(port); + return ix::ws_broadcast_server_main(port, hostname); } else if (app.got_subcommand("ping")) { diff --git a/ws/ws.h b/ws/ws.h index 7766afbc..c9171bca 100644 --- a/ws/ws.h +++ b/ws/ws.h @@ -26,7 +26,7 @@ namespace ix int ws_echo_server_main(int port); - int ws_broadcast_server_main(int port); + int ws_broadcast_server_main(int port, const std::string& hostname); int ws_chat_main(const std::string& url, const std::string& user); diff --git a/ws/ws_broadcast_server.cpp b/ws/ws_broadcast_server.cpp index 6ef7f47b..1d969ad2 100644 --- a/ws/ws_broadcast_server.cpp +++ b/ws/ws_broadcast_server.cpp @@ -10,11 +10,11 @@ namespace ix { - int ws_broadcast_server_main(int port) + int ws_broadcast_server_main(int port, const std::string& hostname) { - std::cout << "Listening on port " << port << std::endl; + std::cout << "Listening on " << hostname << ":" << port << std::endl; - ix::WebSocketServer server(port); + ix::WebSocketServer server(port, hostname); server.setOnConnectionCallback( [&server](std::shared_ptr webSocket)