pub async fn connect<T: AsRef<str>>(
        uri: T,
        cfg: Option<ClientConfig>,
    ) -> Result<
        (
            Client<'a>,
            (
                GenericFuture<'a>,
                Option<UnboundedReceiver<GenericFuture<'a>>>,
            ),
        ),
        WampError,
    > {
        let uri = match Url::parse(uri.as_ref()) {
            Ok(u) => u,
            Err(e) => return Err(WampError::InvalidUri(e)),
        };

        let config = match cfg {
            Some(c) => c,
            // Set defaults
            None => ClientConfig::default(),
        };

        let (ctl_channel, ctl_receiver) = mpsc::unbounded_channel();
        let (core_res_w, core_res) = mpsc::unbounded_channel();

        let ctl_sender = ctl_channel.clone();
        // Establish a connection
        let mut conn = Core::connect(&uri, &config, (ctl_sender, ctl_receiver), core_res_w).await?;

        let rpc_evt_queue = if config.roles.contains(&ClientRole::Callee) {
            conn.rpc_event_queue_r.take()
        } else {
            None
        };

        Ok((
            Client {
                config,
                server_roles: HashSet::new(),
                session_id: None,
                ctl_channel,
                core_res,
                core_status: ClientState::NoEventLoop,
            },
            (Box::pin(conn.event_loop()), rpc_evt_queue),
        ))
    }
/// Connects to a WAMP server using the specified protocol
///
/// __Note__
///
/// On success, this function returns :
/// -  Client : Used to interact with the server
/// -  Main event loop Future : __This MUST be spawned by the caller__ (e.g using tokio::spawn())
/// -  RPC event queue : If you register RPC endpoints, you MUST spawn a seperate task to also handle these events
///
/// To customize parmeters used for the connection, see the [ClientConfig](struct.ClientConfig.html) struct
Connects to a WAMP server using the specified protocol

On success, this function returns :
Client : Used to interact with the server
Main event loop Future : __This MUST be spawned by the caller__ )
RPC event queue : If you register RPC endpoints, you MUST spawn a seperate task to also handle these events

To customize parmeters used for the connection, see the [ClientConfig](struct.ClientConfig.html) struct
Connects to a WAMP server using the specified protocol On success this function returns : Client : Used to interact with the server Main event loop Future : __This MUST be spawned by the caller__ ) RPC event queue : If you register RPC endpoints you MUST spawn a seperate task to also handle these events To customize parmeters used for the connection see the [ ClientConfig ] ( struct . ClientConfig . html ) struct
pub async fn connect<T: AsRef<str>>(
        uri: T,
        cfg: Option<ClientConfig>,
    ) -> Result<
        (
            Client<'a>,
            (
                GenericFuture<'a>,
                Option<UnboundedReceiver<GenericFuture<'a>>>,
            ),
        ),
        WampError,
    > {
        let uri = match Url::parse(uri.as_ref()) {
            Ok(u) => u,
            Err(e) => return Err(WampError::InvalidUri(e)),
        };
        let config = match cfg {
            Some(c) => c,
            // Set defaults
            None => ClientConfig::default(),
        };
        let (ctl_channel, ctl_receiver) = mpsc::unbounded_channel();
        let (core_res_w, core_res) = mpsc::unbounded_channel();
        let ctl_sender = ctl_channel.clone();
        // Establish a connection
        let mut conn = Core::connect(&uri, &config, (ctl_sender, ctl_receiver), core_res_w).await?;
        let rpc_evt_queue = if config.roles.contains(&ClientRole::Callee) {
            conn.rpc_event_queue_r.take()
        } else {
            None
        };
        Ok((
            Client {
                config,
                server_roles: HashSet::new(),
                session_id: None,
                ctl_channel,
                core_res,
                core_status: ClientState::NoEventLoop,
            },
            (Box::pin(conn.event_loop()), rpc_evt_queue),
        ))
    }
pub async fn connect < T : AsRef < str > > ( uri : T , cfg : Option < ClientConfig > , ) -> Result < ( Client < ' a > , ( GenericFuture < ' a > , Option < UnboundedReceiver < GenericFuture < ' a > > > , ) , ) , WampError , > { let uri = match Url :: parse ( uri . as_ref ( ) ) { Ok ( u ) => u , Err ( e ) => return Err ( WampError :: InvalidUri ( e ) ) , } ; let config = match cfg { Some ( c ) => c , // Set defaults None => ClientConfig :: default ( ) , } ; let ( ctl_channel , ctl_receiver ) = mpsc :: unbounded_channel ( ) ; let ( core_res_w , core_res ) = mpsc :: unbounded_channel ( ) ; let ctl_sender = ctl_channel . clone ( ) ; // Establish a connection let mut conn = Core :: connect ( & uri , & config , ( ctl_sender , ctl_receiver ) , core_res_w ) . await ? ; let rpc_evt_queue = if config . roles . contains ( & ClientRole :: Callee ) { conn . rpc_event_queue_r . take ( ) } else { None } ; Ok ( ( Client { config , server_roles : HashSet :: new ( ) , session_id : None , ctl_channel , core_res , core_status : ClientState :: NoEventLoop , } , ( Box :: pin ( conn . event_loop ( ) ) , rpc_evt_queue ) , ) ) }
Connects to a WAMP server using the specified protocol
__Note__
Connects to a WAMP server using the specified protocol __Note__
uri
T
cfg
Option<ClientConfig>