use of org.hyperledger.besu.ethereum.api.jsonrpc.execution.JsonRpcProcessor in project besu by hyperledger.
the class RunnerBuilder method createWebsocketService.
private WebSocketService createWebsocketService(final Vertx vertx, final WebSocketConfiguration configuration, final SubscriptionManager subscriptionManager, final Map<String, JsonRpcMethod> jsonRpcMethods, final PrivacyParameters privacyParameters, final ProtocolSchedule protocolSchedule, final BlockchainQueries blockchainQueries, final Optional<AuthenticationService> authenticationService, final ObservableMetricsSystem metricsSystem) {
final WebSocketMethodsFactory websocketMethodsFactory = new WebSocketMethodsFactory(subscriptionManager, jsonRpcMethods);
if (privacyParameters.isEnabled()) {
final PrivateWebSocketMethodsFactory privateWebSocketMethodsFactory = new PrivateWebSocketMethodsFactory(privacyParameters, subscriptionManager, protocolSchedule, blockchainQueries);
privateWebSocketMethodsFactory.methods().forEach(websocketMethodsFactory::addMethods);
}
rpcEndpointServiceImpl.getPluginMethods(configuration.getRpcApis()).values().forEach(websocketMethodsFactory::addMethods);
final JsonRpcProcessor jsonRpcProcessor;
if (authenticationService.isPresent()) {
jsonRpcProcessor = new AuthenticatedJsonRpcProcessor(new BaseJsonRpcProcessor(), authenticationService.get(), configuration.getRpcApisNoAuth());
} else {
jsonRpcProcessor = new BaseJsonRpcProcessor();
}
final JsonRpcExecutor jsonRpcExecutor = new JsonRpcExecutor(jsonRpcProcessor, websocketMethodsFactory.methods());
final WebSocketMessageHandler websocketMessageHandler = new WebSocketMessageHandler(vertx, jsonRpcExecutor, besuController.getProtocolManager().ethContext().getScheduler(), webSocketConfiguration.getTimeoutSec());
return new WebSocketService(vertx, configuration, websocketMessageHandler, authenticationService, metricsSystem);
}
Aggregations