pub fn notification_document(
method: &MethodName,
params: &JsonObject,
) -> Result<Value, RequestError>Expand description
The notification document, ready to frame.
A notification has no id and never gets a reply, so this is the request document without one rather than a request with a null id — the two are different on the wire and a peer reads the difference.
§Errors
As request_document.
§Examples
use protocol_droid::application::jsonrpc::document::notification_document;
use protocol_droid::domain::ir::{JsonObject, MethodName};
let method = MethodName::new("notifications/initialized")?;
let document = notification_document(&method, &JsonObject::default())?;
assert_eq!(
document.to_string(),
r#"{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}"#,
);