|
|
@ -14,13 +14,16 @@ fn main () { |
|
|
|
spawn(move || { |
|
|
|
spawn(move || { |
|
|
|
let mut websocket = accept(stream.unwrap()).unwrap(); |
|
|
|
let mut websocket = accept(stream.unwrap()).unwrap(); |
|
|
|
loop { |
|
|
|
loop { |
|
|
|
let msg = websocket.read_message().unwrap(); |
|
|
|
match websocket.read_message() { |
|
|
|
|
|
|
|
Ok(msg) => { |
|
|
|
// We do not want to send back ping/pong messages. |
|
|
|
// We do not want to send back ping/pong messages. |
|
|
|
if msg.is_binary() || msg.is_text() { |
|
|
|
if msg.is_binary() || msg.is_text() { |
|
|
|
websocket.write_message(msg).unwrap(); |
|
|
|
websocket.write_message(msg).unwrap(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Err(_) => {} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|