pub struct Worker { /* private fields */ }
Expand description
A worker represents a mediasoup C++ thread that runs on a single CPU core and handles
Router
instances.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn worker_manager(&self) -> &WorkerManager
pub fn worker_manager(&self) -> &WorkerManager
Worker manager to which worker belongs.
Sourcepub async fn update_settings(
&self,
data: WorkerUpdateSettings,
) -> Result<(), RequestError>
pub async fn update_settings( &self, data: WorkerUpdateSettings, ) -> Result<(), RequestError>
Updates the worker settings in runtime. Just a subset of the worker settings can be updated.
Sourcepub async fn create_webrtc_server(
&self,
webrtc_server_options: WebRtcServerOptions,
) -> Result<WebRtcServer, CreateWebRtcServerError>
pub async fn create_webrtc_server( &self, webrtc_server_options: WebRtcServerOptions, ) -> Result<WebRtcServer, CreateWebRtcServerError>
Create a WebRtcServer.
Worker will be kept alive as long as at least one WebRTC server instance is alive.
Sourcepub async fn create_router(
&self,
router_options: RouterOptions,
) -> Result<Router, CreateRouterError>
pub async fn create_router( &self, router_options: RouterOptions, ) -> Result<Router, CreateRouterError>
Create a Router.
Worker will be kept alive as long as at least one router instance is alive.
Sourcepub fn on_new_webrtc_server<F: Fn(&WebRtcServer) + Send + Sync + 'static>(
&self,
callback: F,
) -> HandlerId
pub fn on_new_webrtc_server<F: Fn(&WebRtcServer) + Send + Sync + 'static>( &self, callback: F, ) -> HandlerId
Callback is called when a new WebRTC server is created.
Sourcepub fn on_new_router<F: Fn(&Router) + Send + Sync + 'static>(
&self,
callback: F,
) -> HandlerId
pub fn on_new_router<F: Fn(&Router) + Send + Sync + 'static>( &self, callback: F, ) -> HandlerId
Callback is called when a new router is created.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Worker
impl !RefUnwindSafe for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl !UnwindSafe for Worker
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