From d9afae21b6fb90746d6a60a6bd7afeefe94fbb9f Mon Sep 17 00:00:00 2001 From: sapir Date: Mon, 24 Sep 2018 11:57:36 +0300 Subject: [PATCH] Fix "websocket" example's readme, and make binary names unique (#45) Give each example binary a unique name. This should allow running cargo run --bin in the root directory. --- http-proxy/Cargo.toml | 2 +- http-proxy/README.md | 2 +- rustls/Cargo.toml | 2 +- tls/Cargo.toml | 2 +- websocket-chat/Cargo.toml | 2 +- websocket-chat/README.md | 4 ++-- websocket-tcp-chat/Cargo.toml | 4 ++-- websocket-tcp-chat/README.md | 4 ++-- websocket/Cargo.toml | 4 ++-- websocket/README.md | 9 ++++++++- 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/http-proxy/Cargo.toml b/http-proxy/Cargo.toml index 08040ca8..b06a5946 100644 --- a/http-proxy/Cargo.toml +++ b/http-proxy/Cargo.toml @@ -9,7 +9,7 @@ name = "proxy" path = "src/main.rs" [[bin]] -name = "server" +name = "proxy-example-server" path = "src/server.rs" [dependencies] diff --git a/http-proxy/README.md b/http-proxy/README.md index 69340e1e..2bc8272a 100644 --- a/http-proxy/README.md +++ b/http-proxy/README.md @@ -9,5 +9,5 @@ cargo run --bin proxy To start local backend server: ```sh -cargo run --bin server +cargo run --bin proxy-example-server ``` diff --git a/rustls/Cargo.toml b/rustls/Cargo.toml index 66faee26..5ddf2412 100644 --- a/rustls/Cargo.toml +++ b/rustls/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Nikolay Kim "] workspace = "../" [[bin]] -name = "server" +name = "rustls-server" path = "src/main.rs" [dependencies] diff --git a/tls/Cargo.toml b/tls/Cargo.toml index 731374e3..303000ae 100644 --- a/tls/Cargo.toml +++ b/tls/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Nikolay Kim "] workspace = "../" [[bin]] -name = "server" +name = "tls-server" path = "src/main.rs" [dependencies] diff --git a/websocket-chat/Cargo.toml b/websocket-chat/Cargo.toml index 36bb534c..b6d281ff 100644 --- a/websocket-chat/Cargo.toml +++ b/websocket-chat/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Nikolay Kim "] workspace = "../" [[bin]] -name = "server" +name = "websocket-chat-server" path = "src/main.rs" [dependencies] diff --git a/websocket-chat/README.md b/websocket-chat/README.md index a463cfed..b8265ea1 100644 --- a/websocket-chat/README.md +++ b/websocket-chat/README.md @@ -19,13 +19,13 @@ Chat server listens for incoming tcp connections. Server can access several type * `some message` - just string, send message to all peers in same room * client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets dropped -To start server use command: `cargo run --bin server` +To start server use command: `cargo run --bin websocket-chat-server` ## Client Client connects to server. Reads input from stdin and sends to server. -To run client use command: `cargo run --bin client` +To run client use command: `cargo run --bin websocket-chat-client` ## WebSocket Browser Client diff --git a/websocket-tcp-chat/Cargo.toml b/websocket-tcp-chat/Cargo.toml index 3e1ca28e..c73d5678 100644 --- a/websocket-tcp-chat/Cargo.toml +++ b/websocket-tcp-chat/Cargo.toml @@ -5,11 +5,11 @@ authors = ["Nikolay Kim "] workspace = "../" [[bin]] -name = "server" +name = "websocket-tcp-server" path = "src/main.rs" [[bin]] -name = "client" +name = "websocket-tcp-client" path = "src/client.rs" [dependencies] diff --git a/websocket-tcp-chat/README.md b/websocket-tcp-chat/README.md index a463cfed..0712597b 100644 --- a/websocket-tcp-chat/README.md +++ b/websocket-tcp-chat/README.md @@ -19,13 +19,13 @@ Chat server listens for incoming tcp connections. Server can access several type * `some message` - just string, send message to all peers in same room * client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets dropped -To start server use command: `cargo run --bin server` +To start server use command: `cargo run --bin websocket-tcp-server` ## Client Client connects to server. Reads input from stdin and sends to server. -To run client use command: `cargo run --bin client` +To run client use command: `cargo run --bin websocket-tcp-client` ## WebSocket Browser Client diff --git a/websocket/Cargo.toml b/websocket/Cargo.toml index 3ab32e52..4ed656ec 100644 --- a/websocket/Cargo.toml +++ b/websocket/Cargo.toml @@ -5,11 +5,11 @@ authors = ["Nikolay Kim "] workspace = "../" [[bin]] -name = "server" +name = "websocket-server" path = "src/main.rs" [[bin]] -name = "client" +name = "websocket-client" path = "src/client.rs" [dependencies] diff --git a/websocket/README.md b/websocket/README.md index 47043f18..643abdfc 100644 --- a/websocket/README.md +++ b/websocket/README.md @@ -8,7 +8,7 @@ Simple echo websocket server. ```bash cd examples/websocket -cargo run +cargo run --bin websocket-server # Started http server: 127.0.0.1:8080 ``` @@ -16,6 +16,13 @@ cargo run - [http://localhost:8080/ws/index.html](http://localhost:8080/ws/index.html) +### rust client + +```bash +cd examples/websocket +cargo run --bin websocket-client +``` + ### python client - ``pip install aiohttp``