pub struct WebSocketFace { /* private fields */ }Expand description
NDN face over WebSocket with binary message framing.
The WebSocket stream is split into independent read and write halves, each
behind its own Mutex — mirroring the TcpFace pattern.
Implementations§
Source§impl WebSocketFace
impl WebSocketFace
Sourcepub async fn connect(
id: FaceId,
url: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn connect( id: FaceId, url: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Connect to a WebSocket endpoint (client side).
Sourcepub fn from_stream(
id: FaceId,
ws: WebSocketStream<MaybeTlsStream<TcpStream>>,
remote_addr: String,
local_addr: String,
) -> Self
pub fn from_stream( id: FaceId, ws: WebSocketStream<MaybeTlsStream<TcpStream>>, remote_addr: String, local_addr: String, ) -> Self
Wrap an already-accepted WebSocket stream (server side).
pub fn remote_addr(&self) -> &str
pub fn local_addr(&self) -> &str
Trait Implementations§
Source§impl Face for WebSocketFace
impl Face for WebSocketFace
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
Source§fn remote_uri(&self) -> Option<String>
fn remote_uri(&self) -> Option<String>
Remote URI (e.g.
udp4://192.168.1.1:6363). Returns None for face
types that don’t have a meaningful remote endpoint.Source§fn local_uri(&self) -> Option<String>
fn local_uri(&self) -> Option<String>
Local URI (e.g.
unix:///run/nfd/nfd.sock). Returns None for face
types that don’t expose local binding info.Source§async fn recv(&self) -> Result<Bytes, FaceError>
async fn recv(&self) -> Result<Bytes, FaceError>
Receive the next packet. Blocks until a packet arrives or the face closes.
Source§async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
Send a packet. Must not block the caller; use internal buffering. Read more
Auto Trait Implementations§
impl !Freeze for WebSocketFace
impl !RefUnwindSafe for WebSocketFace
impl Send for WebSocketFace
impl Sync for WebSocketFace
impl Unpin for WebSocketFace
impl !UnwindSafe for WebSocketFace
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