/// Create a new client and connect to the server.
Create a new client and connect to the server.
Create a new client and connect to the server .
pub async fn new(event_handler: T, token: impl Into<String>) -> Result<Self> {
        let ws_client = WebSocketClient::connect().await?;
        let (messenger, action_rx) = ActionMessenger::new();
        let context = Context::new(token, messenger);
        Ok(Self {
            event_handler: Arc::new(event_handler),
            ws_client,
            action_rx,
            context,
        })
    }
pub async fn new ( event_handler : T , token : impl Into < String > ) -> Result < Self > { let ws_client = WebSocketClient :: connect ( ) . await ? ; let ( messenger , action_rx ) = ActionMessenger :: new ( ) ; let context = Context :: new ( token , messenger ) ; Ok ( Self { event_handler : Arc :: new ( event_handler ) , ws_client , action_rx , context , } ) }
Create a new client and connect to the server.
Create a new client and connect to the server .
event_handler
T
token
impl Into<String>