#[non_exhaustive]pub struct ServerSseMessage {
pub event_id: Option<String>,
pub message: Option<Arc<ServerJsonRpcMessage>>,
pub retry: Option<Duration>,
}Available on (crate features
client or server) and crate feature transport-streamable-http-server only.Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.event_id: Option<String>The event ID for this message. When set, clients can use this ID
with the Last-Event-ID header to resume the stream from this point.
message: Option<Arc<ServerJsonRpcMessage>>The JSON-RPC message content. Set to None for priming events.
See SEP-1699
retry: Option<Duration>The retry interval hint for clients. Clients should wait this duration
before attempting to reconnect. This maps to the SSE retry: field.
Implementations§
Source§impl ServerSseMessage
impl ServerSseMessage
Sourcepub fn new(event_id: impl Into<String>, message: ServerJsonRpcMessage) -> Self
pub fn new(event_id: impl Into<String>, message: ServerJsonRpcMessage) -> Self
Create a message carrying a JSON-RPC response/notification with an event ID.
Sourcepub fn from_message(message: ServerJsonRpcMessage) -> Self
pub fn from_message(message: ServerJsonRpcMessage) -> Self
Wrap a JSON-RPC message without an event ID or retry hint.
Trait Implementations§
Source§impl Clone for ServerSseMessage
impl Clone for ServerSseMessage
Source§fn clone(&self) -> ServerSseMessage
fn clone(&self) -> ServerSseMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerSseMessage
impl Debug for ServerSseMessage
Source§impl Default for ServerSseMessage
impl Default for ServerSseMessage
Source§fn default() -> ServerSseMessage
fn default() -> ServerSseMessage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ServerSseMessage
impl !RefUnwindSafe for ServerSseMessage
impl Send for ServerSseMessage
impl Sync for ServerSseMessage
impl Unpin for ServerSseMessage
impl UnsafeUnpin for ServerSseMessage
impl !UnwindSafe for ServerSseMessage
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