Search in sources :

Example 1 with WebSocketRequestHandler

use of org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketRequestHandler 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 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 WebSocketRequestHandler websocketRequestHandler = new WebSocketRequestHandler(vertx, websocketMethodsFactory.methods(), besuController.getProtocolManager().ethContext().getScheduler(), webSocketConfiguration.getTimeoutSec());
    return new WebSocketService(vertx, configuration, websocketRequestHandler, authenticationService);
}
Also used : WebSocketRequestHandler(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketRequestHandler) WebSocketService(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketService) WebSocketMethodsFactory(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.methods.WebSocketMethodsFactory) PrivateWebSocketMethodsFactory(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.methods.PrivateWebSocketMethodsFactory) PrivateWebSocketMethodsFactory(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.methods.PrivateWebSocketMethodsFactory)

Aggregations

WebSocketRequestHandler (org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketRequestHandler)1 WebSocketService (org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketService)1 PrivateWebSocketMethodsFactory (org.hyperledger.besu.ethereum.api.jsonrpc.websocket.methods.PrivateWebSocketMethodsFactory)1 WebSocketMethodsFactory (org.hyperledger.besu.ethereum.api.jsonrpc.websocket.methods.WebSocketMethodsFactory)1