pub struct Connection { /* private fields */ }Expand description
Handle to a live FIX session.
Cloning is cheap; all clones refer to the same session. The session is
closed when the transport drops, the counterparty logs out, a heartbeat
timeout is detected, or Connection::logout completes.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn session_id(&self) -> &SessionId
pub fn session_id(&self) -> &SessionId
Returns the session identifier.
Sourcepub async fn send(&self, message: OutboundMessage) -> Result<(), EngineError>
pub async fn send(&self, message: OutboundMessage) -> Result<(), EngineError>
Sends an application message on the session.
The engine stamps the standard header (including MsgSeqNum) and trailer; the message only needs body fields.
§Arguments
message- The application message to send
§Errors
Returns EngineError::Closed if the session is already closed.
Sourcepub async fn logout(&self) -> Result<(), EngineError>
pub async fn logout(&self) -> Result<(), EngineError>
Initiates a graceful logout.
A Logout message is sent to the counterparty; the session closes when
the Logout acknowledgement arrives or the logout timeout elapses.
Use Connection::wait_closed to observe completion.
§Errors
Returns EngineError::Closed if the session is already closed.
Sourcepub async fn wait_closed(&self)
pub async fn wait_closed(&self)
Waits until the session is closed.
Fires on transport drop, counterparty logout, heartbeat timeout, or completion of a locally initiated logout. Returns immediately if the session is already closed.
Sourcepub fn is_timed_out(&self) -> bool
pub fn is_timed_out(&self) -> bool
Returns true if the session has detected a heartbeat timeout (a TestRequest went unanswered for a full heartbeat interval).
Sourcepub fn next_sender_seq(&self) -> u64
pub fn next_sender_seq(&self) -> u64
Returns the next outgoing (sender) sequence number.
Sourcepub fn next_target_seq(&self) -> u64
pub fn next_target_seq(&self) -> u64
Returns the next expected incoming (target) sequence number.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more