pub fn receiver(self) -> mpsc::Receiver<Result<ws::Frame, WsError<()>>> {
        let (tx, rx): (_, mpsc::Receiver<Result<ws::Frame, WsError<()>>>) = mpsc::channel();

        rt::spawn(async move {
            let tx2 = tx.clone();
            let io = self.io.get_ref();

            let result = self
                .start(into_service(move |item: ws::Frame| {
                    match tx.send(Ok(item)) {
                        Ok(()) => (),
                        Err(_) => io.close(),
                    };
                    Ready::Ok::<Option<ws::Message>, ()>(None)
                }))
                .await;

            if let Err(e) = result {
                let _ = tx2.send(Err(e));
            }
        });

        rx
    }
// TODO: fix close frame handling
/// Start client websockets with `SinkService` and `mpsc::Receiver<Frame>`
fix close frame handling
Start client websockets with `SinkService` and `mpsc::Receiver`
fix close frame handling Start client websockets with ` SinkService ` and ` mpsc :: Receiver `
pub fn receiver(self) -> mpsc::Receiver<Result<ws::Frame, WsError<()>>> {
        let (tx, rx): (_, mpsc::Receiver<Result<ws::Frame, WsError<()>>>) = mpsc::channel();
        rt::spawn(async move {
            let tx2 = tx.clone();
            let io = self.io.get_ref();
            let result = self
                .start(into_service(move |item: ws::Frame| {
                    match tx.send(Ok(item)) {
                        Ok(()) => (),
                        Err(_) => io.close(),
                    };
                    Ready::Ok::<Option<ws::Message>, ()>(None)
                }))
                .await;
            if let Err(e) = result {
                let _ = tx2.send(Err(e));
            }
        });
        rx
    }
pub fn receiver ( self ) -> mpsc :: Receiver < Result < ws :: Frame , WsError < ( ) > > > { let ( tx , rx ) : ( _ , mpsc :: Receiver < Result < ws :: Frame , WsError < ( ) > > > ) = mpsc :: channel ( ) ; rt :: spawn ( async move { let tx2 = tx . clone ( ) ; let io = self . io . get_ref ( ) ; let result = self . start ( into_service ( move | item : ws :: Frame | { match tx . send ( Ok ( item ) ) { Ok ( ( ) ) => ( ) , Err ( _ ) => io . close ( ) , } ; Ready :: Ok :: < Option < ws :: Message > , ( ) > ( None ) } ) ) . await ; if let Err ( e ) = result { let _ = tx2 . send ( Err ( e ) ) ; } } ) ; rx }
TODO: fix close frame handling
Start client websockets with `SinkService` and `mpsc::Receiver<Frame>`
TODO : fix close frame handling Start client websockets with ` SinkService ` and ` mpsc :: Receiver<Frame > `
self
self