pub struct WebmcpServer { /* private fields */ }Expand description
Authenticated WebSocket WebMCP server.
Implementations§
Source§impl WebmcpServer
impl WebmcpServer
Sourcepub fn new(
adapter: Arc<dyn RuntimeAdapter>,
config: WebmcpServerConfig,
) -> Result<Self>
pub fn new( adapter: Arc<dyn RuntimeAdapter>, config: WebmcpServerConfig, ) -> Result<Self>
Create a server around an active or headless runtime adapter.
Sourcepub fn begin_pairing(&self) -> PairingDisplay
pub fn begin_pairing(&self) -> PairingDisplay
Start a new one-time terminal pairing code.
Sourcepub fn begin_pairing_for_origin(
&self,
origin: impl Into<String>,
) -> Result<PairingDisplay>
pub fn begin_pairing_for_origin( &self, origin: impl Into<String>, ) -> Result<PairingDisplay>
Start a one-time code bound to one exact allowed browser origin.
Sourcepub fn replace_pairing_for_origin(
&self,
origin: impl Into<String>,
) -> Result<PairingDisplay>
pub fn replace_pairing_for_origin( &self, origin: impl Into<String>, ) -> Result<PairingDisplay>
Revoke browser sessions and issue a fresh code for one exact origin.
Sourcepub fn revoke_all_pairings(&self)
pub fn revoke_all_pairings(&self)
Revoke all browser sessions and pending pairing codes.
Sourcepub fn event_hub(&self) -> WebmcpEventHub
pub fn event_hub(&self) -> WebmcpEventHub
Access the canonical runtime event hub used by this server.
Sourcepub fn router(&self) -> Router
pub fn router(&self) -> Router
Build the WebSocket router. No listener is opened by this method.
Sourcepub async fn bind(&self) -> Result<TcpListener>
pub async fn bind(&self) -> Result<TcpListener>
Bind the configured address. Call Self::serve_listener afterwards.
Sourcepub async fn serve_listener(&self, listener: TcpListener) -> Result<()>
pub async fn serve_listener(&self, listener: TcpListener) -> Result<()>
Serve on a caller-provided listener until it fails or is stopped.
Trait Implementations§
Source§impl Clone for WebmcpServer
impl Clone for WebmcpServer
Source§fn clone(&self) -> WebmcpServer
fn clone(&self) -> WebmcpServer
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for WebmcpServer
impl !UnwindSafe for WebmcpServer
impl Freeze for WebmcpServer
impl Send for WebmcpServer
impl Sync for WebmcpServer
impl Unpin for WebmcpServer
impl UnsafeUnpin for WebmcpServer
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