Skip to content

Commit

Permalink
add keep-alive for default http
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jan 19, 2024
1 parent 0521e15 commit fdaf61f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,18 @@ impl RpcServer {
enable_websocket: bool,
) -> Result<SocketAddr, AnyError> {
let stream_config = StreamServerConfig::default()
.with_keep_alive(true)
.with_channel_size(4)
.with_pipeline_size(4);

let cors = CorsLayer::permissive();

// HTTP and WS server.
let method_router =
post(handle_jsonrpc::<Option<Session>>).get(handle_jsonrpc_ws::<Option<Session>>);
let mut app = Router::new()
.route("/", method_router.clone())
.route("/*path", method_router)
.layer(Extension(Arc::clone(rpc)))
.layer(cors)
.layer(CorsLayer::permissive())
.layer(TimeoutLayer::new(Duration::from_secs(30)));

if enable_websocket {
Expand Down

0 comments on commit fdaf61f

Please sign in to comment.