Include client age/UA string when closing due to a spurious keepalive request.

This commit is contained in:
Jon Chambers
2020-11-10 11:30:32 -05:00
committed by Jon Chambers
parent adbc4e9fec
commit 7cf50a15d0
2 changed files with 11 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ public class WebSocketClient {
private final RemoteEndpoint remoteEndpoint;
private final WebSocketMessageFactory messageFactory;
private final Map<Long, CompletableFuture<WebSocketResponseMessage>> pendingRequestMapper;
private final long created;
public WebSocketClient(Session session, RemoteEndpoint remoteEndpoint,
WebSocketMessageFactory messageFactory,
@@ -40,6 +41,7 @@ public class WebSocketClient {
this.remoteEndpoint = remoteEndpoint;
this.messageFactory = messageFactory;
this.pendingRequestMapper = pendingRequestMapper;
this.created = System.currentTimeMillis();
}
public CompletableFuture<WebSocketResponseMessage> sendRequest(String verb, String path,
@@ -78,6 +80,10 @@ public class WebSocketClient {
return session.getUpgradeRequest().getHeader("User-Agent");
}
public long getCreatedTimestamp() {
return this.created;
}
public void close(int code, String message) {
session.close(code, message);
}