pub struct WebSocketDispatcher { /* private fields */ }Expand description
WebSocket-based A2A dispatcher.
Accepts WebSocket connections and processes JSON-RPC 2.0 messages over the WebSocket channel. Streaming responses are sent as individual text frames.
Implementations§
Source§impl WebSocketDispatcher
impl WebSocketDispatcher
Sourcepub const fn new(handler: Arc<RequestHandler>) -> WebSocketDispatcher
pub const fn new(handler: Arc<RequestHandler>) -> WebSocketDispatcher
Creates a new WebSocket dispatcher.
Sourcepub async fn serve(
self: Arc<WebSocketDispatcher>,
addr: impl ToSocketAddrs,
) -> Result<(), Error>
pub async fn serve( self: Arc<WebSocketDispatcher>, addr: impl ToSocketAddrs, ) -> Result<(), Error>
Starts a WebSocket server on the given address.
§Errors
Returns std::io::Error if the TCP listener fails to bind.
Sourcepub async fn serve_with_addr(
self: Arc<WebSocketDispatcher>,
addr: impl ToSocketAddrs,
) -> Result<SocketAddr, Error>
pub async fn serve_with_addr( self: Arc<WebSocketDispatcher>, addr: impl ToSocketAddrs, ) -> Result<SocketAddr, Error>
Starts a WebSocket server and returns the bound address.
Like serve, but useful for tests (bind to port 0).
§Errors
Returns std::io::Error if the TCP listener fails to bind.
Auto Trait Implementations§
impl Freeze for WebSocketDispatcher
impl !RefUnwindSafe for WebSocketDispatcher
impl Send for WebSocketDispatcher
impl Sync for WebSocketDispatcher
impl Unpin for WebSocketDispatcher
impl UnsafeUnpin for WebSocketDispatcher
impl !UnwindSafe for WebSocketDispatcher
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request