|
|
@ -8,6 +8,7 @@ use std::thread::spawn; |
|
|
|
use tungstenite::server::accept; |
|
|
|
use tungstenite::server::accept; |
|
|
|
|
|
|
|
|
|
|
|
/// A WebSocket echo server |
|
|
|
/// A WebSocket echo server |
|
|
|
|
|
|
|
fn main () { |
|
|
|
let server = TcpListener::bind("127.0.0.1:9001").unwrap(); |
|
|
|
let server = TcpListener::bind("127.0.0.1:9001").unwrap(); |
|
|
|
for stream in server.incoming() { |
|
|
|
for stream in server.incoming() { |
|
|
|
spawn (move || { |
|
|
|
spawn (move || { |
|
|
@ -22,6 +23,7 @@ for stream in server.incoming() { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Take a look at the examples section to see how to write a simple client/server. |
|
|
|
Take a look at the examples section to see how to write a simple client/server. |
|
|
|