pub struct ServerHttpSseResponse { /* private fields */ }Expand description
A server-bound modern SSE response body.
The transport body owns peer-drop cancellation. A graceful HTTP
subscriptions/listen ends with its correlated final response (normally a
complete result, or a canonical post-admission error); it never emits an
MCP notifications/cancelled control.
Implementations§
Source§impl ServerHttpSseResponse
impl ServerHttpSseResponse
Sourcepub fn response(&self) -> &HttpResponse
pub fn response(&self) -> &HttpResponse
Returns the HTTP response head for this SSE body.
Sourcepub fn cancellation(&self) -> ServerHttpRequestCancellation
pub fn cancellation(&self) -> ServerHttpRequestCancellation
Returns the cancellation view shared by the transport body and MCP request.
Sourcepub fn sender(&self) -> StreamableHttpRequestResponseSender
pub fn sender(&self) -> StreamableHttpRequestResponseSender
Returns the producer bound to this exact response body.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns whether either the transport body or the graceful terminal sequence reached its completed state.
Sourcepub fn pop_event(&self) -> Result<Option<SseEvent>, ServerHttpEndpointError>
pub fn pop_event(&self) -> Result<Option<SseEvent>, ServerHttpEndpointError>
Pops the next queued event, then reports a fully drained terminal sequence as a closed body rather than an indefinitely pending queue.
§Errors
Returns the underlying transport failure, or ServerHttpEndpointError::Closed
after the final terminal response has drained.
Sourcepub fn recv_event(&self, cx: &Cx) -> Result<SseEvent, ServerHttpEndpointError>
pub fn recv_event(&self, cx: &Cx) -> Result<SseEvent, ServerHttpEndpointError>
Receives the next event while observing both transport and MCP terminal cancellation.
§Errors
Returns the underlying transport failure, or ServerHttpEndpointError::Closed
when the response body, MCP request, or caller context is terminal.