Struct openethereum::rpc::WsServer
source · [−]pub struct WsServer {
addr: SocketAddr,
handle: Option<JoinHandle<Result<(), Error>>>,
executor: Arc<Mutex<Option<Executor>>>,
broadcaster: Sender,
}
Expand description
WebSockets
server implementation.
Fields
addr: SocketAddr
handle: Option<JoinHandle<Result<(), Error>>>
executor: Arc<Mutex<Option<Executor>>>
broadcaster: Sender
Implementations
sourceimpl Server
impl Server
sourcepub fn addr(&self) -> &SocketAddr
pub fn addr(&self) -> &SocketAddr
Returns the address this server is listening on
sourcepub fn broadcaster(&self) -> Broadcaster
pub fn broadcaster(&self) -> Broadcaster
Returns a Broadcaster that can be used to send messages on all connections.
sourcepub fn start<M, S>(
addr: &SocketAddr,
handler: Arc<MetaIoHandler<M, S>>,
meta_extractor: Arc<dyn MetaExtractor<M> + 'static>,
allowed_origins: Option<Vec<Origin, Global>>,
allowed_hosts: Option<Vec<Host, Global>>,
request_middleware: Option<Arc<dyn RequestMiddleware + 'static>>,
stats: Option<Arc<dyn SessionStats + 'static>>,
executor: UninitializedExecutor,
max_connections: usize,
max_payload_bytes: usize
) -> Result<Server, Error> where
M: Metadata,
S: Middleware<M>,
pub fn start<M, S>(
addr: &SocketAddr,
handler: Arc<MetaIoHandler<M, S>>,
meta_extractor: Arc<dyn MetaExtractor<M> + 'static>,
allowed_origins: Option<Vec<Origin, Global>>,
allowed_hosts: Option<Vec<Host, Global>>,
request_middleware: Option<Arc<dyn RequestMiddleware + 'static>>,
stats: Option<Arc<dyn SessionStats + 'static>>,
executor: UninitializedExecutor,
max_connections: usize,
max_payload_bytes: usize
) -> Result<Server, Error> where
M: Metadata,
S: Middleware<M>,
Starts a new WebSocket
server in separate thread.
Returns a Server
handle which closes the server when droped.
sourceimpl Server
impl Server
sourcepub fn close_handle(&self) -> CloseHandle
pub fn close_handle(&self) -> CloseHandle
Returns a handle to the server that can be used to close it while another thread is
blocking in wait
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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