Struct jsonrpc_ws_server::ServerBuilder
source · [−]pub struct ServerBuilder<M: Metadata, S: Middleware<M>> { /* private fields */ }
Expand description
Builder for WebSockets
server
Implementations
sourceimpl<M: Metadata + Default, S: Middleware<M>> ServerBuilder<M, S>
impl<M: Metadata + Default, S: Middleware<M>> ServerBuilder<M, S>
sourcepub fn new<T>(handler: T) -> Self where
T: Into<MetaIoHandler<M, S>>,
pub fn new<T>(handler: T) -> Self where
T: Into<MetaIoHandler<M, S>>,
Creates new ServerBuilder
sourceimpl<M: Metadata, S: Middleware<M>> ServerBuilder<M, S>
impl<M: Metadata, S: Middleware<M>> ServerBuilder<M, S>
sourcepub fn with_meta_extractor<T, E>(handler: T, extractor: E) -> Self where
T: Into<MetaIoHandler<M, S>>,
E: MetaExtractor<M>,
pub fn with_meta_extractor<T, E>(handler: T, extractor: E) -> Self where
T: Into<MetaIoHandler<M, S>>,
E: MetaExtractor<M>,
Creates new ServerBuilder
sourcepub fn event_loop_executor(self, executor: TaskExecutor) -> Self
pub fn event_loop_executor(self, executor: TaskExecutor) -> Self
Utilize existing event loop executor to poll RPC results.
sourcepub fn session_meta_extractor<T: MetaExtractor<M>>(self, extractor: T) -> Self
pub fn session_meta_extractor<T: MetaExtractor<M>>(self, extractor: T) -> Self
Sets a meta extractor.
sourcepub fn allowed_origins(self, allowed_origins: DomainsValidation<Origin>) -> Self
pub fn allowed_origins(self, allowed_origins: DomainsValidation<Origin>) -> Self
Allowed origins.
sourcepub fn allowed_hosts(self, allowed_hosts: DomainsValidation<Host>) -> Self
pub fn allowed_hosts(self, allowed_hosts: DomainsValidation<Host>) -> Self
Allowed hosts.
sourcepub fn session_stats<T: SessionStats>(self, stats: T) -> Self
pub fn session_stats<T: SessionStats>(self, stats: T) -> Self
Session stats
sourcepub fn request_middleware<T: RequestMiddleware>(self, middleware: T) -> Self
pub fn request_middleware<T: RequestMiddleware>(self, middleware: T) -> Self
Sets a request middleware. Middleware will be invoked before each handshake request. You can either terminate the handshake in the middleware or run a default behaviour after.
sourcepub fn max_connections(self, max_connections: usize) -> Self
pub fn max_connections(self, max_connections: usize) -> Self
Maximal number of concurrent connections this server supports. Default: 100
sourcepub fn max_payload(self, max_payload_bytes: usize) -> Self
pub fn max_payload(self, max_payload_bytes: usize) -> Self
Maximal size of the payload (in bytes) Default: 5MB
sourcepub fn start(self, addr: &SocketAddr) -> Result<Server>
pub fn start(self, addr: &SocketAddr) -> Result<Server>
Starts a new WebSocket
server in separate thread.
Returns a Server
handle which closes the server when droped.
Auto Trait Implementations
impl<M, S> !RefUnwindSafe for ServerBuilder<M, S>
impl<M, S> Send for ServerBuilder<M, S>
impl<M, S> Sync for ServerBuilder<M, S>
impl<M, S> Unpin for ServerBuilder<M, S>
impl<M, S> !UnwindSafe for ServerBuilder<M, S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more