pub fn start_ws(
	addr: &std::net::SocketAddr,
	io: RpcHandler,
) -> io::Result<ws::Server> {
	ws::ServerBuilder::with_meta_extractor(io, |context: &ws::RequestContext| Metadata::new(context.sender()))
		.max_payload(MAX_PAYLOAD)
		.start(addr)
		.map_err(|err| match err {
			ws::Error(ws::ErrorKind::Io(io), _) => io,
			ws::Error(ws::ErrorKind::ConnectionClosed, _) => io::ErrorKind::BrokenPipe.into(),
			ws::Error(e, _) => {
				error!("{}", e);
				io::ErrorKind::Other.into()
			}
		})
}
/// Start WS server listening on given address.
Start WS server listening on given address.
Start WS server listening on given address .
pub fn start_ws(
	addr: &std::net::SocketAddr,
	io: RpcHandler,
) -> io::Result<ws::Server> {
	ws::ServerBuilder::with_meta_extractor(io, |context: &ws::RequestContext| Metadata::new(context.sender()))
		.max_payload(MAX_PAYLOAD)
		.start(addr)
		.map_err(|err| match err {
			ws::Error(ws::ErrorKind::Io(io), _) => io,
			ws::Error(ws::ErrorKind::ConnectionClosed, _) => io::ErrorKind::BrokenPipe.into(),
			ws::Error(e, _) => {
				error!("{}", e);
				io::ErrorKind::Other.into()
			}
		})
}
pub fn start_ws ( addr : & std :: net :: SocketAddr , io : RpcHandler , ) -> io :: Result < ws :: Server > { ws :: ServerBuilder :: with_meta_extractor ( io , | context : & ws :: RequestContext | Metadata :: new ( context . sender ( ) ) ) . max_payload ( MAX_PAYLOAD ) . start ( addr ) . map_err ( | err | match err { ws :: Error ( ws :: ErrorKind :: Io ( io ) , _ ) => io , ws :: Error ( ws :: ErrorKind :: ConnectionClosed , _ ) => io :: ErrorKind :: BrokenPipe . into ( ) , ws :: Error ( e , _ ) => { error ! ( " " e ) ; io :: ErrorKind :: Other . into ( ) } } ) }
Start WS server listening on given address.
Start WS server listening on given address .
addr
&std::net::SocketAddr
io
RpcHandler
addr
&std::net::SocketAddr
io
RpcHandler