Skip to content

How to send customized ping message on connectionLostTimeout interval #941

@gharia

Description

@gharia

Describe what you would like to know or do
How to send a custom Ping message on connectionLostTimeout?

Describe the solution you'd considered
For creating a WS client, I am extending WebSocketClient. I did setConnectionLostTimeout to 30 seconds. and override the sendPing() method

@Override
  public void sendPing() {
    log.info("Sending ping");
    JsonObject pingObj = new JsonObject();
    pingObj.addProperty("id", "NGenerated guid id");
    pingObj.addProperty("type", "ping");
    this.send(pingObj.toString());
  }

I thought it would be simple, just to override sendPing(). But it is not the case. My overridden method never gets invoked. Rather it calls engine's sendPing()

Additional context
It's not causing any connection close issue, but I am just looking for a way o customize the send ping message.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions