mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
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.
This commit is contained in:
parent
8edf86e4b8
commit
d9afae21b6
@ -9,7 +9,7 @@ name = "proxy"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "proxy-example-server"
|
||||||
path = "src/server.rs"
|
path = "src/server.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -9,5 +9,5 @@ cargo run --bin proxy
|
|||||||
To start local backend server:
|
To start local backend server:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cargo run --bin server
|
cargo run --bin proxy-example-server
|
||||||
```
|
```
|
||||||
|
@ -5,7 +5,7 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
|||||||
workspace = "../"
|
workspace = "../"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "rustls-server"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -5,7 +5,7 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
|||||||
workspace = "../"
|
workspace = "../"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "tls-server"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -5,7 +5,7 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
|||||||
workspace = "../"
|
workspace = "../"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "websocket-chat-server"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -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
|
* `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
|
* 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
|
||||||
|
|
||||||
Client connects to server. Reads input from stdin and sends to server.
|
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
|
## WebSocket Browser Client
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
|||||||
workspace = "../"
|
workspace = "../"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "websocket-tcp-server"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "client"
|
name = "websocket-tcp-client"
|
||||||
path = "src/client.rs"
|
path = "src/client.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -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
|
* `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
|
* 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
|
||||||
|
|
||||||
Client connects to server. Reads input from stdin and sends to server.
|
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
|
## WebSocket Browser Client
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
|||||||
workspace = "../"
|
workspace = "../"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "server"
|
name = "websocket-server"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "client"
|
name = "websocket-client"
|
||||||
path = "src/client.rs"
|
path = "src/client.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -8,7 +8,7 @@ Simple echo websocket server.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd examples/websocket
|
cd examples/websocket
|
||||||
cargo run
|
cargo run --bin websocket-server
|
||||||
# Started http server: 127.0.0.1:8080
|
# 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)
|
- [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
|
### python client
|
||||||
|
|
||||||
- ``pip install aiohttp``
|
- ``pip install aiohttp``
|
||||||
|
Loading…
Reference in New Issue
Block a user