Feature description_
- Public method
setListener in org.web3j.protocol.websocket.WebSocketClient is very confusing.
Some default and important actions are defined in private method setWebSocketListener in org.web3j.protocol.websocket.WebSocketService which is also called by its connect method.
I tried to run the code below and always got a timeout error coz requestForId was never used.
final WebSocketClient webSocketClient = new WebSocketClient(new URI("ws://localhost:8546"));
webSocketClient.setListener(new WebSocketListener() {
@Override
public void onMessage(String message) {
}
@Override
public void onError(Exception e) {
}
@Override
public void onClose() {
}
});
webSocketClient.connectBlocking();
final WebSocketService webSocketService = new WebSocketService(webSocketClient, false);
I think method setListener in org.web3j.protocol.websocket.WebSocketClient should be private.It's very likely to write that code and cost hours to read the source code.
- Listener Chain is needed.
Feature description_
setListenerinorg.web3j.protocol.websocket.WebSocketClientis very confusing.Some default and important actions are defined in private method
setWebSocketListenerinorg.web3j.protocol.websocket.WebSocketServicewhich is also called by itsconnectmethod.I tried to run the code below and always got a timeout error coz
requestForIdwas never used.I think method
setListenerinorg.web3j.protocol.websocket.WebSocketClientshould be private.It's very likely to write that code and cost hours to read the source code.