pub struct Client { /* private fields */ }
Expand description
A reconnecting version of super::Client
.
Does not reconnect automatically but provides a method Client::reconnect
for explicit reconnection,
when the user finds it necessary.
Can be cloned to utilize the same connection from multiple fibers.
See super::AsClient
for the full API.
Implementations§
source§impl Client
impl Client
sourcepub fn reconnect(&self)
pub fn reconnect(&self)
Request client to reconnect before executing next operation.
If one of the cloned clients (used in other fibers/places) has already reconnected, this client will use this new connection instead of trying to establish a new one.
When reconnection happens ongoing requests (processing in other fibers) will continue on the old connection, but any new request will use the new connection.
sourcepub async fn reconnect_now(&self) -> Result<(), Error>
pub async fn reconnect_now(&self) -> Result<(), Error>
Force reconnection.
If one of the cloned clients (used in other fibers/places) has already reconnected, this client will use this new connection instead of trying to establish a new one.
When reconnection happens ongoing requests (processing in other fibers) will continue on the old connection, but any new request will use the new connection.
Errors
Error is returned if reconnection fails.
See Error
.
sourcepub fn new(url: String, port: u16) -> Self
pub fn new(url: String, port: u16) -> Self
Creates a new client but does not yet try to establish connection
to url:port
. This will happen at the first call through super::AsClient
methods.