pub struct VoltConnection { /* private fields */ }Expand description
Manages a persistent connection to a Volt server
Implementations§
Source§impl VoltConnection
impl VoltConnection
Sourcepub fn new(config: &VoltClientConfig) -> Self
pub fn new(config: &VoltClientConfig) -> Self
Create a new connection manager
Sourcepub async fn state(&self) -> ConnectionState
pub async fn state(&self) -> ConnectionState
Get the current connection state
Sourcepub async fn connection_id(&self) -> String
pub async fn connection_id(&self) -> String
Get the connection ID
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if connected
Sourcepub async fn connect(
&mut self,
hello_payload: Option<Value>,
) -> Result<EventReceiver>
pub async fn connect( &mut self, hello_payload: Option<Value>, ) -> Result<EventReceiver>
Connect to the Volt server
Returns a receiver for connection events
Sourcepub async fn disconnect(&mut self)
pub async fn disconnect(&mut self)
Disconnect from the server
Sourcepub async fn send(&self, request: ConnectRequest) -> Result<()>
pub async fn send(&self, request: ConnectRequest) -> Result<()>
Send a message on the connection
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VoltConnection
impl !RefUnwindSafe for VoltConnection
impl Send for VoltConnection
impl Sync for VoltConnection
impl Unpin for VoltConnection
impl !UnwindSafe for VoltConnection
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request