Struct jsonrpc_core::request_handler::RequestHandler
[−]
[src]
pub struct RequestHandler { /* fields omitted */ }
Requests handler - maps Commander
outputs into well-formed JSONRPC Responses
Methods
impl RequestHandler
[src]
fn new() -> Self
Creates new RequestHandler
fn add_method<C>(&self, name: String, command: C) where C: MethodCommand + 'static
Adds supported method
fn add_notification<C>(&self, name: String, command: C) where C: NotificationCommand + 'static
Adds supported notification
fn add_subscription<C>(&self,
subscribe: String,
subscription: String,
unsubscribe: String,
command: C) where C: SubscriptionCommand + 'static
subscribe: String,
subscription: String,
unsubscribe: String,
command: C) where C: SubscriptionCommand + 'static
Adds supported subscription
fn add_methods(&self, methods: HashMap<String, Box<MethodCommand>>)
Adds a batch of supported methods
fn add_notifications(&self,
notifications: HashMap<String, Box<NotificationCommand>>)
notifications: HashMap<String, Box<NotificationCommand>>)
Adds a batch of supported notifications
fn add_subscriptions(&self,
subscriptions: HashMap<(String, String, String), Box<SubscriptionCommand>>)
subscriptions: HashMap<(String, String, String), Box<SubscriptionCommand>>)
Adds a batch of supported subscriptions
fn handle_request<A: 'static>(&self,
request: Request,
handler: Handler<A, Option<Response>, Notification>,
session: Option<Session>)
request: Request,
handler: Handler<A, Option<Response>, Notification>,
session: Option<Session>)
Handle single request
Some(response)
is returned in case that request is a method call.
None
is returned in case of notifications and empty batches.