Struct WebSocketRpcClient

Source
pub struct WebSocketRpcClient(/* private fields */);
Expand description

Client API RPC client to talk with server via WebSocket.

Implementations§

Source§

impl WebSocketRpcClient

Source

pub fn new(rpc_transport_factory: RpcTransportFactory) -> Self

Creates new WebSocketRpcClient with provided RpcTransportFactory closure.

Source

pub fn join_room( &self, room_id: RoomId, member_id: MemberId, credential: Credential, capabilities: Capabilities, )

Authorizes WebSocketRpcClient on the Media Server.

Source

pub fn leave_room(&self, room_id: RoomId, member_id: MemberId)

Leaves Room with a provided RoomId.

Source

pub async fn connect( self: Rc<Self>, url: ApiUrl, ) -> Result<(), Traced<RpcClientError>>

Tries to upgrade ClientState of this WebSocketRpcClient to ClientState::Open.

This function is also used for reconnecting this WebSocketRpcClient.

If WebSocketRpcClient is closed than this function will try to establish new RPC connection.

If WebSocketRpcClient already in ClientState::Connecting then this function will not perform one more connection try. It will subscribe to ClientState changes and wait for first connection result, and, based on this result, this function will be resolved.

If WebSocketRpcClient already in ClientState::Open then this function will be instantly resolved.

§Errors

Errors if WebSocketRpcClient fails to establish connection with a server.

Source

pub fn subscribe(&self) -> LocalBoxStream<'static, RpcEvent>

Subscribes on this WebSocketRpcClient’s RpcEvents.

Source

pub fn send_command(&self, room_id: RoomId, command: Command)

Sends Command for the provided RoomId to server.

Source

pub fn on_normal_close( &self, ) -> LocalBoxFuture<'static, Result<CloseReason, Canceled>>

Future resolving on normal WebSocketRpcClient connection closing.

This Future wouldn’t be resolved on abnormal closes. An WebSocketRpcClient::on_connection_loss will be thrown instead.

Source

pub fn on_connection_loss( &self, ) -> LocalBoxStream<'static, ConnectionLostReason>

Subscribe to connection loss events.

Connection loss is any unexpected platform::RpcTransport close. In case of connection loss, client side user should select reconnection strategy with ReconnectHandle (or simply close Room).

Source

pub fn set_close_reason(&self, close_reason: ClientDisconnect)

Sets reason being passed to the underlying transport when this client is dropped.

Trait Implementations§

Source§

impl Debug for WebSocketRpcClient

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<E> WrapTraced<E> for E

Source§

fn wrap_traced(self, f: Frame) -> Traced<E>

Wraps this error into a Traced wrapper, storing the given Frame of a Trace inside.
Source§

impl<T> DartSafe for T

Source§

impl<T> ErasedDestructor for T
where T: 'static,