Closed airas-careem closed 1 year ago
Describe what you would like to know or do I want to change the default PING interval which is 1 min
Additional context
Following is my WebSocket client code. I have checked the docs but could not find any option to change the ping interval. The library I am using is
import org.java_websocket.WebSocket; import org.java_websocket.client.WebSocketClient;
` WebSocketClient client = new WebSocketClient(new URI("ws://localhost:8080/BiDiEnvelopeChannel/fabric/bidicommunication")) {
@Override public void onOpen(ServerHandshake handshake) { System.out.println("Connection established to the server"); } @Override public void onMessage(String message) { System.out.println("Received message: " + message); } @Override public void onMessage(ByteBuffer message) { try { Envelope envelope = Envelope.parseFrom(message.array()); System.out.println("Received Binary message =====> " + envelope + " ******* "); } catch (InvalidProtocolBufferException e) { System.out.println("Received Binary message and failed to parse it " + e.getMessage()); e.printStackTrace(); } } @Override public void onClose(int code, String reason, boolean remote) { System.out.println("Connection closed"); } @Override public void onError(Exception ex) { System.out.println("error on websocket client: " + ex.getMessage()); } @Override public void onWebsocketPong(WebSocket conn, Framedata f) { System.out.println("received "+ f.getOpcode()); } }; client.connect();`
Do you mean this? https://github.com/TooTallNate/Java-WebSocket/wiki/Lost-connection-detection#change-the-check-interval
Describe what you would like to know or do I want to change the default PING interval which is 1 min
Additional context
Following is my WebSocket client code. I have checked the docs but could not find any option to change the ping interval. The library I am using is
import org.java_websocket.WebSocket; import org.java_websocket.client.WebSocketClient;
` WebSocketClient client = new WebSocketClient(new URI("ws://localhost:8080/BiDiEnvelopeChannel/fabric/bidicommunication")) {