[−][src]Struct websocket_rs::Websocket
Implementations
impl<S: 'static> Websocket<S> where
S: AsyncRead + AsyncWrite + Unpin + Send,
[src]
S: AsyncRead + AsyncWrite + Unpin + Send,
pub fn new(stream: S) -> Self
[src]
Create a new websocket instance, given any type that implements
AsyncRead + AsyncWrite
like tokio::net::TcpStream
or tokio_native_tls::TlsStream
pub fn new_with_key(stream: S, key: String) -> Self
[src]
Same as Websocket::new
except that it also accept a key that represent
the value of Sec-Websocket-Key
for client that requires a valid
Sec-Websocket-Accept
in response headers.
pub async fn next<'_>(&'_ mut self) -> Option<Message>
[src]
Wait for next frame to come. (support incoming fragmented frames)
pub async fn send_text<'_, T: AsRef<str>>(
&'_ mut self,
t: T
) -> WebsocketResult<()>
[src]
&'_ mut self,
t: T
) -> WebsocketResult<()>
Send a text frame
Trait Implementations
Auto Trait Implementations
impl<S> !RefUnwindSafe for Websocket<S>
impl<S> Send for Websocket<S> where
S: Send,
S: Send,
impl<S> Sync for Websocket<S> where
S: Sync,
S: Sync,
impl<S> Unpin for Websocket<S>
impl<S> !UnwindSafe for Websocket<S>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,