pub fn connect_text<OUT: 'static>(
        url: &str,
        callback: Callback<OUT>,
        notification: Callback<WebSocketStatus>,
    ) -> Result<WebSocketTask, WebSocketError>
    where
        OUT: From<Text>,
    {
        let ConnectCommon(ws, listeners) = Self::connect_common(url, &notification)?;
        let listener = EventListener::new(&ws, "message", move |event: &Event| {
            let event = event.dyn_ref::<MessageEvent>().unwrap();
            process_text(&event, &callback);
        });
        Ok(WebSocketTask::new(ws, notification, listener, listeners))
    }
/// Connects to a server through a WebSocket connection, like connect,
/// but only processes text frames. Binary frames are silently
/// ignored. Needs two functions to generate data and notification
/// messages.
Connects to a server through a WebSocket connection, like connect,
but only processes text frames. Binary frames are silently
ignored. Needs two functions to generate data and notification
messages.
Connects to a server through a WebSocket connection like connect but only processes text frames . Binary frames are silently ignored . Needs two functions to generate data and notification messages .
pub fn connect_text<OUT: 'static>(
        url: &str,
        callback: Callback<OUT>,
        notification: Callback<WebSocketStatus>,
    ) -> Result<WebSocketTask, WebSocketError>
    where
        OUT: From<Text>,
    {
        let ConnectCommon(ws, listeners) = Self::connect_common(url, &notification)?;
        let listener = EventListener::new(&ws, "message", move |event: &Event| {
            let event = event.dyn_ref::<MessageEvent>().unwrap();
            process_text(&event, &callback);
        });
        Ok(WebSocketTask::new(ws, notification, listener, listeners))
    }
pub fn connect_text < OUT : ' static > ( url : & str , callback : Callback < OUT > , notification : Callback < WebSocketStatus > , ) -> Result < WebSocketTask , WebSocketError > where OUT : From < Text > , { let ConnectCommon ( ws , listeners ) = Self :: connect_common ( url , & notification ) ? ; let listener = EventListener :: new ( & ws , " " , move | event : & Event | { let event = event . dyn_ref :: < MessageEvent > ( ) . unwrap ( ) ; process_text ( & event , & callback ) ; } ) ; Ok ( WebSocketTask :: new ( ws , notification , listener , listeners ) ) }
Connects to a server through a WebSocket connection, like connect,
but only processes text frames.
Connects to a server through a WebSocket connection like connect but only processes text frames .
url
&str
callback
Callback<OUT>
notification
Callback<WebSocketStatus>
url
&str
callback
Callback<OUT>
notification
Callback<WebSocketStatus>