Struct dcl_rpc::messages_handlers::StreamsHandler
source · pub struct StreamsHandler { /* private fields */ }Expand description
In charge of handling the acknowledge listener for Stream Messages so that it knows that it has to send the next StreamMessage
Implementations§
source§impl StreamsHandler
impl StreamsHandler
pub fn new() -> Self
sourcepub async fn send_stream_through_transport(
&self,
transport: Arc<dyn Transport + Send + Sync>,
stream_generator: Generator<Vec<u8>>,
port_id: u32,
message_identifier: u32
) -> Result<(), CommonError>
pub async fn send_stream_through_transport( &self, transport: Arc<dyn Transport + Send + Sync>, stream_generator: Generator<Vec<u8>>, port_id: u32, message_identifier: u32 ) -> Result<(), CommonError>
As it receives encoded messages from the stream_generator, it’ll be sending StreamMessages through the given transport in the parameters.
It handles the sequence id for each StreamMessage, it’ll await for the acknowlegde of each message in the other half to conitnue with the messages sending.
Also, it stops the generator and break the loop if the other half closed the stream. Otherwise, it will close the strram when the stream_generator doesn’t have more messages.
sourcepub fn message_acknowledged_by_peer(
self: Arc<Self>,
message_identifier: u32,
payload: Vec<u8>
)
pub fn message_acknowledged_by_peer( self: Arc<Self>, message_identifier: u32, payload: Vec<u8> )
Notify the acknowledge listener registered in send_stream that the message was acknowledge by the other peer and it can continue sending the pending messages
Trait Implementations§
source§impl Default for StreamsHandler
impl Default for StreamsHandler
source§fn default() -> StreamsHandler
fn default() -> StreamsHandler
Returns the “default value” for a type. Read more