pub enum HttpServerRequest {
Http(IncomingHttpRequest),
WebSocketOpen {
path: String,
channel_id: u32,
source_socket_addr: Option<String>,
forwarded_for: Option<String>,
},
WebSocketPush {
channel_id: u32,
message_type: WsMessageType,
},
WebSocketClose(u32),
}Expand description
crate::Request received from the http-server:distro:sys service as a
result of either an HTTP or WebSocket binding, created via HttpServerAction.
Variants§
Http(IncomingHttpRequest)
WebSocketOpen
Processes will receive this kind of request when a client connects to them.
If a process does not want this websocket open, they should issue a crate::Request
containing a HttpServerAction::WebSocketClose message and this channel ID.
Fields
WebSocketPush
Processes can both SEND and RECEIVE this kind of crate::Request
(send as HttpServerAction::WebSocketPush).
When received, will contain the message bytes as crate::LazyLoadBlob.
WebSocketClose(u32)
Receiving will indicate that the client closed the socket. Can be sent to close
from the server-side, as HttpServerAction::WebSocketClose.
Implementations§
Source§impl HttpServerRequest
impl HttpServerRequest
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse a byte slice into an HttpServerRequest.
Sourcepub fn request(self) -> Option<IncomingHttpRequest>
pub fn request(self) -> Option<IncomingHttpRequest>
Filter the general-purpose HttpServerRequest, which contains HTTP requests
and WebSocket messages, into just the HTTP request. Consumes the original request
and returns None if the request was WebSocket-related.
Trait Implementations§
Source§impl Clone for HttpServerRequest
impl Clone for HttpServerRequest
Source§fn clone(&self) -> HttpServerRequest
fn clone(&self) -> HttpServerRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpServerRequest
impl Debug for HttpServerRequest
Source§impl<'de> Deserialize<'de> for HttpServerRequest
impl<'de> Deserialize<'de> for HttpServerRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for HttpServerRequest
impl RefUnwindSafe for HttpServerRequest
impl Send for HttpServerRequest
impl Sync for HttpServerRequest
impl Unpin for HttpServerRequest
impl UnwindSafe for HttpServerRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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