pub trait NotificationBroadcaster: Send + Sync {
// Required methods
fn send_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ProgressNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_message_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: LoggingMessageNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_resource_updated_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceUpdatedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_resource_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_tool_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ToolListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_prompt_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: PromptListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: CancelledNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn broadcast_to_all_sessions<'life0, 'async_trait>(
&'life0 self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
MCP-compliant notification broadcaster trait for sending ALL notification types over SSE
ALL methods send proper JSON-RPC notifications per MCP 2025-06-18 specification
Required Methods§
Sourcefn send_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ProgressNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ProgressNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a progress notification (notifications/progress) Used for long-running operations to show progress updates
Sourcefn send_message_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: LoggingMessageNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_message_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: LoggingMessageNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a logging message notification (notifications/message) Used to send log messages with different levels (debug, info, warning, error)
Sourcefn send_resource_updated_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceUpdatedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_resource_updated_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceUpdatedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send resource updated notification (notifications/resources/updated) Notifies that a specific resource has been updated
Sourcefn send_resource_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_resource_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ResourceListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send resource list changed notification (notifications/resources/listChanged) Notifies that the resource list has changed (added/removed resources)
Sourcefn send_tool_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ToolListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_tool_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: ToolListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send tool list changed notification (notifications/tools/listChanged) Notifies that the tool list has changed (added/removed tools)
Sourcefn send_prompt_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: PromptListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_prompt_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: PromptListChangedNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send prompt list changed notification (notifications/prompts/listChanged) Notifies that the prompt list has changed (added/removed prompts)
Sourcefn send_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: CancelledNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: CancelledNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send cancelled notification (notifications/cancelled) Can be sent by either client or server to cancel a request
Sourcefn broadcast_to_all_sessions<'life0, 'async_trait>(
&'life0 self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn broadcast_to_all_sessions<'life0, 'async_trait>(
&'life0 self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Broadcast any JSON-RPC notification to all active sessions (server-wide notifications)
Sourcefn send_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<(), BroadcastError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send any generic JSON-RPC notification to a specific session