pub struct Relay { /* private fields */ }Expand description
The relay’s sessions by provider name (wsrelay.Manager).
Implementations§
Source§impl Relay
impl Relay
pub fn set_observer(&self, observer: Observer)
Sourcepub fn connect(self: &Arc<Self>) -> (Arc<Session>, UnboundedReceiver<String>)
pub fn connect(self: &Arc<Self>) -> (Arc<Session>, UnboundedReceiver<String>)
handleWebsocket after the upgrade: a session under a new provider name, which
replaces any session of that name, then OnConnected. Returns the session and the
frames the route must write.
Sourcepub fn connect_as(
self: &Arc<Self>,
provider: String,
) -> (Arc<Session>, UnboundedReceiver<String>)
pub fn connect_as( self: &Arc<Self>, provider: String, ) -> (Arc<Session>, UnboundedReceiver<String>)
Relay::connect under a given name (tests).
Sourcepub async fn non_stream(
&self,
provider: &str,
req: &HttpRequest,
) -> Result<HttpResponse, String>
pub async fn non_stream( &self, provider: &str, req: &HttpRequest, ) -> Result<HttpResponse, String>
Manager.NonStream: an http_response, or the body of a streamed answer
collected until stream_end (or the session closing).
Sourcepub async fn stream(
&self,
provider: &str,
req: &HttpRequest,
) -> Result<Receiver<StreamEvent>, String>
pub async fn stream( &self, provider: &str, req: &HttpRequest, ) -> Result<Receiver<StreamEvent>, String>
Manager.Stream: start, chunk, end, error and complete-response events; a
closed session ends with an “wsrelay: stream closed” error event.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Relay
impl Forget for Relay
impl Move for Relay
impl RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl UnsafeUnpin for Relay
impl UnwindSafe for Relay
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more