Trait witty_jsonrpc::server::Server
source · pub trait Server<H>where
H: Handler,{
type Error;
// Required methods
fn start(&mut self) -> Result<(), Self::Error>;
fn stop(&mut self) -> Result<(), Self::Error>;
fn add_method<F>(&mut self, name: &str, method: F)
where F: RpcMethodSimple;
fn add_subscription<F, G>(
&mut self,
notification: &str,
subscribe: (&str, F),
unsubscribe: (&str, G)
)
where F: SubscribeRpcMethod<H::Metadata>,
G: UnsubscribeRpcMethod<H::Metadata>;
fn describe_api(&self) -> Vec<String>;
}Expand description
Trait defining a JSON-RPC server.
Required Associated Types§
Required Methods§
sourcefn start(&mut self) -> Result<(), Self::Error>
fn start(&mut self) -> Result<(), Self::Error>
Start the server.
This is expexted to be highly side effected, i.e. this is where sockets and listeners are started.
sourcefn add_method<F>(&mut self, name: &str, method: F)where
F: RpcMethodSimple,
fn add_method<F>(&mut self, name: &str, method: F)where F: RpcMethodSimple,
Add a JSON-RPC method to the server.
sourcefn add_subscription<F, G>(
&mut self,
notification: &str,
subscribe: (&str, F),
unsubscribe: (&str, G)
)where
F: SubscribeRpcMethod<H::Metadata>,
G: UnsubscribeRpcMethod<H::Metadata>,
fn add_subscription<F, G>( &mut self, notification: &str, subscribe: (&str, F), unsubscribe: (&str, G) )where F: SubscribeRpcMethod<H::Metadata>, G: UnsubscribeRpcMethod<H::Metadata>,
Add a JSON-RPC subscription so the server.
sourcefn describe_api(&self) -> Vec<String>
fn describe_api(&self) -> Vec<String>
Get a list of all the supported JSON-RPC methods.