|
|
@ -9,6 +9,8 @@ |
|
|
|
* according to those terms. |
|
|
|
* according to those terms. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! WebSocket implementation of the Broker
|
|
|
|
|
|
|
|
|
|
|
|
use async_std::net::{TcpListener, TcpStream}; |
|
|
|
use async_std::net::{TcpListener, TcpStream}; |
|
|
|
use async_std::sync::Mutex; |
|
|
|
use async_std::sync::Mutex; |
|
|
|
use async_std::task; |
|
|
|
use async_std::task; |
|
|
@ -25,7 +27,7 @@ |
|
|
|
use tempfile::Builder; |
|
|
|
use tempfile::Builder; |
|
|
|
use std::{thread, time}; |
|
|
|
use std::{thread, time}; |
|
|
|
|
|
|
|
|
|
|
|
pub async fn connection_loop(tcp: TcpStream, mut handler: ProtocolHandler) -> std::io::Result<()> { |
|
|
|
async fn connection_loop(tcp: TcpStream, mut handler: ProtocolHandler) -> std::io::Result<()> { |
|
|
|
let mut ws = accept_async(tcp).await.unwrap(); |
|
|
|
let mut ws = accept_async(tcp).await.unwrap(); |
|
|
|
let (mut tx, mut rx) = ws.split(); |
|
|
|
let (mut tx, mut rx) = ws.split(); |
|
|
|
|
|
|
|
|
|
|
|