I use web3j in my Java application. In the smart contract, an event is defined.
event sendEvent(string name);
I subscribed to that event in my app.
contract.sendEventEventFlowable(filter)
.subscribe(doc -> {
System.out.println(doc.name);
}, throwable -> {
throwable.printStackTrace();
}, () -> {
System.out.println("End of research");
});
It works, But I noticed that Web3j listens to the Blockchain every 15 seconds.
That is not suitable for my application and I need to listen to what is happening inside the blockchain all the time.
How can I change the default value (15 sec)?
This is my code
WebSocketService ws = new WebSocketService("ws://localhost:8545", true);
ws.connect();
web3 = Web3j.build(ws);