pub struct MobileRpcServer { /* private fields */ }Available on crate feature
server only.Expand description
Mobile RPC Server (16-byte header protocol)
Use this for mobile clients with bandwidth constraints. 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) -> MobileRpcServer
pub fn with_max_connections(self, max: usize) -> MobileRpcServer
pub fn register_service(&mut self, service: Arc<dyn Service>)
pub fn with_zoo_client(self, zoo_client: Arc<ZusZooClient>) -> MobileRpcServer
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request