pub struct MobileRpcServer { /* private fields */ }Expand description
Mobile RPC Server
Similar to ZusServerManager but uses the mobile 16-byte protocol. Automatically handles heartbeat packets.
§Example
ⓘ
use zus_rpc_server::{MobileRpcServer, Service};
struct MyService;
impl Service for MyService {
fn service_name(&self) -> &str { "MyService" }
async fn do_work(&self, method: &str, params: Bytes, ctx: RequestContext) -> Result<Bytes> {
Ok(params)
}
}
let mut server = MobileRpcServer::new("0.0.0.0".to_string(), 9528);
server.register_service(Arc::new(MyService));
server.start().await?;Implementations§
Source§impl MobileRpcServer
impl MobileRpcServer
pub fn new(address: String, port: u16) -> Self
pub fn with_max_connections(self, max: usize) -> Self
pub fn register_service(&mut self, service: Arc<dyn Service>)
pub fn with_zoo_client(self, zoo_client: Arc<ZusZooClient>) -> Self
Sourcepub fn get_statistics(&self, service_name: &str) -> Option<ServiceStatistics>
pub fn get_statistics(&self, service_name: &str) -> Option<ServiceStatistics>
Get statistics for a specific service
Sourcepub fn get_all_statistics(&self) -> HashMap<String, ServiceStatistics>
pub fn get_all_statistics(&self) -> HashMap<String, ServiceStatistics>
Get statistics for all registered services
Sourcepub fn reset_statistics(&self, service_name: &str)
pub fn reset_statistics(&self, service_name: &str)
Reset statistics for a specific service
Sourcepub fn reset_all_statistics(&self)
pub fn reset_all_statistics(&self)
Reset statistics for all services
Auto Trait Implementations§
impl Freeze for MobileRpcServer
impl !RefUnwindSafe for MobileRpcServer
impl Send for MobileRpcServer
impl Sync for MobileRpcServer
impl Unpin for MobileRpcServer
impl !UnwindSafe for MobileRpcServer
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