[][src]Struct webrtc_unreliable::Server

pub struct Server { /* fields omitted */ }

Methods

impl Server[src]

pub async fn new(
    listen_addr: SocketAddr,
    public_addr: SocketAddr
) -> Result<Server, IoError>
[src]

Start a new WebRTC data channel server listening on listen_addr and advertising its publicly available address as public_addr.

WebRTC connections must be started via an external communication channel from a browser via the SessionEndpoint, after which a WebRTC data channel can be opened.

pub fn session_endpoint(&self) -> SessionEndpoint[src]

Returns a SessionEndpoint which can be used to start new WebRTC sessions.

WebRTC connections must be started via an external communication channel from a browser via the returned RtcSessionEndpoint, and this communication channel will be used to exchange session descriptions in SDP format.

The returned RtcSessionEndpoint will notify this RtcServer of new sessions via a shared async channel. This is done so that the RtcSessionEndpoint is easy to use in a separate server task (such as a hyper HTTP server).

pub fn is_connected(&self, remote_addr: &SocketAddr) -> bool[src]

Returns true if the client has a completely established WebRTC data channel connection and can send messages back and forth. Returns false for disconnected clients as well as those that are still starting up or are in the process of shutting down.

pub fn disconnect(&mut self, remote_addr: &SocketAddr)[src]

Disconect the given client, does nothing if the client is not currently connected.

pub async fn send<'_, '_, '_>(
    &'_ mut self,
    message: &'_ [u8],
    message_type: MessageType,
    remote_addr: &'_ SocketAddr
) -> Result<(), SendError>
[src]

Send the given message to the given remote client, if they are connected.

pub async fn recv<'_, '_>(
    &'_ mut self,
    buf: &'_ mut [u8]
) -> Result<MessageResult, RecvError>
[src]

Receive a WebRTC data channel message from any connected client.

Server::recv must be called for proper operation of the server, as it also handles background tasks such as responding to STUN packets and timing out existing sessions.

Auto Trait Implementations

impl !RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl !UnwindSafe for Server

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,