pub struct LocalSessionHandle { /* private fields */ }transport-streamable-http-server-session and (crate features client or server) only.Implementations§
Source§impl LocalSessionHandle
impl LocalSessionHandle
Sourcepub async fn close(&self) -> Result<(), SessionError>
pub async fn close(&self) -> Result<(), SessionError>
Close the session
Sourcepub async fn push_message(
&self,
message: ClientJsonRpcMessage,
http_request_id: Option<u64>,
) -> Result<(), SessionError>
pub async fn push_message( &self, message: ClientJsonRpcMessage, http_request_id: Option<u64>, ) -> Result<(), SessionError>
Send a message to the session
Sourcepub async fn establish_request_wise_channel(
&self,
) -> Result<StreamableHttpMessageReceiver, SessionError>
pub async fn establish_request_wise_channel( &self, ) -> Result<StreamableHttpMessageReceiver, SessionError>
establish a channel for a http-request, the corresponded message from server will be
sent through this channel. The channel will be closed when the request is completed,
or you can close it manually by calling LocalSessionHandle::close_request_wise_channel.
Sourcepub async fn close_request_wise_channel(
&self,
request_id: u64,
) -> Result<(), SessionError>
pub async fn close_request_wise_channel( &self, request_id: u64, ) -> Result<(), SessionError>
close the http-request wise channel.
Sourcepub async fn establish_common_channel(
&self,
) -> Result<StreamableHttpMessageReceiver, SessionError>
pub async fn establish_common_channel( &self, ) -> Result<StreamableHttpMessageReceiver, SessionError>
Establish a common channel for general purpose messages.
Sourcepub async fn resume(
&self,
last_event_id: EventId,
) -> Result<StreamableHttpMessageReceiver, SessionError>
pub async fn resume( &self, last_event_id: EventId, ) -> Result<StreamableHttpMessageReceiver, SessionError>
Resume streaming response by the last event id. This is suitable for both request wise and common channel.
Sourcepub async fn initialize(
&self,
request: ClientJsonRpcMessage,
) -> Result<ServerJsonRpcMessage, SessionError>
pub async fn initialize( &self, request: ClientJsonRpcMessage, ) -> Result<ServerJsonRpcMessage, SessionError>
Send an initialize request to the session. And wait for the initialized response.
This is used to establish a session with the server.
Sourcepub async fn close_sse_stream(
&self,
http_request_id: u64,
retry_interval: Option<Duration>,
) -> Result<(), SessionError>
pub async fn close_sse_stream( &self, http_request_id: u64, retry_interval: Option<Duration>, ) -> Result<(), SessionError>
Close an SSE stream for a specific request.
This closes the SSE connection for a POST request stream, but keeps the session
and message cache active. Clients can reconnect using the Last-Event-ID header
via a GET request to resume receiving messages.
§Arguments
http_request_id- The HTTP request ID of the stream to closeretry_interval- Optional retry interval. If provided, a priming event is sent
Sourcepub async fn close_standalone_sse_stream(
&self,
retry_interval: Option<Duration>,
) -> Result<(), SessionError>
pub async fn close_standalone_sse_stream( &self, retry_interval: Option<Duration>, ) -> Result<(), SessionError>
Close the standalone SSE stream.
This closes the standalone SSE connection (established via GET request),
but keeps the session and message cache active. Clients can reconnect using
the Last-Event-ID header via a GET request to resume receiving messages.
§Arguments
retry_interval- Optional retry interval. If provided, a priming event is sent