jsonrpsee_server/lib.rs
1// Copyright 2019-2021 Parity Technologies (UK) Ltd.
2//
3// Permission is hereby granted, free of charge, to any
4// person obtaining a copy of this software and associated
5// documentation files (the "Software"), to deal in the
6// Software without restriction, including without
7// limitation the rights to use, copy, modify, merge,
8// publish, distribute, sublicense, and/or sell copies of
9// the Software, and to permit persons to whom the Software
10// is furnished to do so, subject to the following
11// conditions:
12//
13// The above copyright notice and this permission notice
14// shall be included in all copies or substantial portions
15// of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27//! # jsonrpsee-server
28//!
29//! `jsonrpsee-server` is a [JSON RPC](https://www.jsonrpc.org/specification) server that supports both HTTP and WebSocket transport.
30//!
31//! Vendored from [jsonrpsee](https://github.com/paritytech/jsonrpsee), Copyright (c) 2019-2021
32//! Parity Technologies (UK) Ltd., licensed under the MIT License (see
33//! `crates/rpc/jsonrpsee/LICENSE`).
34
35#![cfg_attr(not(test), warn(unused_crate_dependencies))]
36#![cfg_attr(docsrs, feature(doc_cfg))]
37
38mod future;
39mod server;
40mod transport;
41mod utils;
42
43pub mod middleware;
44
45#[cfg(test)]
46mod tests;
47
48pub use future::{
49 stop_channel, AlreadyStoppedError, ConnectionGuard, ConnectionPermit, ServerHandle, StopHandle,
50};
51pub use jsonrpsee_core::{
52 error::RegisterMethodError, id_providers::*, server::*, traits::IdProvider,
53};
54pub use jsonrpsee_types as types;
55pub use server::{
56 handle_rpc_call, BatchRequestConfig, Builder as ServerBuilder, ConnectionState, Server,
57 ServerConfig, ServerConfigBuilder, TowerServiceNoHttp,
58};
59pub use tracing;
60
61pub use jsonrpsee_core::http_helpers::{
62 Body as HttpBody, Request as HttpRequest, Response as HttpResponse,
63};
64pub use transport::{http, ws};
65pub use utils::{accept_error_backoff, serve_with_graceful_shutdown};
66
67pub(crate) const LOG_TARGET: &str = "jsonrpsee-server";