pub struct HttpLongPollClient<H, O> { /* private fields */ }Expand description
An HTTP long-poll client that connects to a Subduction server.
After connecting, spawn the returned ConnectResult::poll_task and
ConnectResult::send_task futures to drive the connection.
§Type Parameters
H: The HTTP client implementationO: The timeout strategy
Implementations§
Source§impl<H, O> HttpLongPollClient<H, O>
impl<H, O> HttpLongPollClient<H, O>
Sourcepub fn new(
base_url: &str,
http: H,
timeout: O,
default_time_limit: Duration,
) -> Self
pub fn new( base_url: &str, http: H, timeout: O, default_time_limit: Duration, ) -> Self
Create a new HTTP long-poll client.
base_url: The server’s base URL, e.g.,http://localhost:8080.http: The HTTP client implementation.timeout: The timeout strategy.default_time_limit: Default timeout for call operations.
Source§impl<H, O> HttpLongPollClient<H, O>
impl<H, O> HttpLongPollClient<H, O>
Sourcepub fn connect<'a, K: FutureForm, Sig: Signer<K>>(
&'a self,
signer: &'a Sig,
expected_peer_id: PeerId,
now: TimestampSeconds,
) -> K::Future<'a, Result<ConnectResult<K, O>, ClientError>>
pub fn connect<'a, K: FutureForm, Sig: Signer<K>>( &'a self, signer: &'a Sig, expected_peer_id: PeerId, now: TimestampSeconds, ) -> K::Future<'a, Result<ConnectResult<K, O>, ClientError>>
Connect to the server with a known peer ID.
The FutureForm variant K is inferred from the HTTP client H:
Sendable for native clients,
Local for browser fetch().
§Errors
Returns ClientError if the handshake or connection setup fails.
Sourcepub fn connect_discover<'a, K: FutureForm, Sig: Signer<K>>(
&'a self,
signer: &'a Sig,
service_name: &str,
now: TimestampSeconds,
) -> K::Future<'a, Result<ConnectResult<K, O>, ClientError>>
pub fn connect_discover<'a, K: FutureForm, Sig: Signer<K>>( &'a self, signer: &'a Sig, service_name: &str, now: TimestampSeconds, ) -> K::Future<'a, Result<ConnectResult<K, O>, ClientError>>
Connect to the server using service discovery.
The FutureForm variant K is inferred from the HTTP client H:
Sendable for native clients,
Local for browser fetch().
§Errors
Returns ClientError if the handshake or connection setup fails.
Trait Implementations§
Source§impl<H: Clone, O: Clone> Clone for HttpLongPollClient<H, O>
impl<H: Clone, O: Clone> Clone for HttpLongPollClient<H, O>
Source§fn clone(&self) -> HttpLongPollClient<H, O>
fn clone(&self) -> HttpLongPollClient<H, O>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Sig: Signer<Local>, H: HttpClient<Local> + 'static, O: Timeout<Local> + Clone + 'static> Connect<Local, Sig> for HttpLongPollClient<H, O>
impl<Sig: Signer<Local>, H: HttpClient<Local> + 'static, O: Timeout<Local> + Clone + 'static> Connect<Local, Sig> for HttpLongPollClient<H, O>
Source§fn connect_with_audience<'a>(
&'a self,
signer: &'a Sig,
audience: Audience,
now: TimestampSeconds,
) -> LocalBoxFuture<'a, Result<ConnectResult<Local, O>, ClientError>>
fn connect_with_audience<'a>( &'a self, signer: &'a Sig, audience: Audience, now: TimestampSeconds, ) -> LocalBoxFuture<'a, Result<ConnectResult<Local, O>, ClientError>>
Source§impl<Sig, H, O> Connect<Sendable, Sig> for HttpLongPollClient<H, O>
impl<Sig, H, O> Connect<Sendable, Sig> for HttpLongPollClient<H, O>
Source§fn connect_with_audience<'a>(
&'a self,
signer: &'a Sig,
audience: Audience,
now: TimestampSeconds,
) -> BoxFuture<'a, Result<ConnectResult<Sendable, O>, ClientError>>
fn connect_with_audience<'a>( &'a self, signer: &'a Sig, audience: Audience, now: TimestampSeconds, ) -> BoxFuture<'a, Result<ConnectResult<Sendable, O>, ClientError>>
Auto Trait Implementations§
impl<H, O> Freeze for HttpLongPollClient<H, O>
impl<H, O> RefUnwindSafe for HttpLongPollClient<H, O>where
H: RefUnwindSafe,
O: RefUnwindSafe,
impl<H, O> Send for HttpLongPollClient<H, O>
impl<H, O> Sync for HttpLongPollClient<H, O>
impl<H, O> Unpin for HttpLongPollClient<H, O>
impl<H, O> UnsafeUnpin for HttpLongPollClient<H, O>where
H: UnsafeUnpin,
O: UnsafeUnpin,
impl<H, O> UnwindSafe for HttpLongPollClient<H, O>where
H: UnwindSafe,
O: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more