Skip to content

Commit

Permalink
Handle WS-ping
Browse files Browse the repository at this point in the history
  • Loading branch information
olle committed Nov 25, 2024
1 parent fca9926 commit ecaf613
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JAVA_HOME=$(shell unset JAVA_HOME; /usr/libexec/java_home -v 17)
JAVA_HOME=$(shell unset JAVA_HOME; /usr/libexec/java_home -v 21)

.PHONY: run build test verify clean tidy

Expand Down
4 changes: 2 additions & 2 deletions ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<version>3.4.0</version>
<relativePath />
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<java.version>21</java.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public WebSocketApiHandler(EventEmitter emitter) {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {

log().info("CONNECTED {}", session);

sessionsById.put(session.getId(),
new ConcurrentWebSocketSessionDecorator(session, SEND_TIME_LIMIT, SEND_BUFFER_SIZE_LIMIT));
}
Expand All @@ -56,6 +58,11 @@ public void afterConnectionClosed(WebSocketSession session, CloseStatus status)
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {

if ("ping".equals(message.getPayload())) {
session.sendMessage(new TextMessage("pong"));
return;
}

emitter.emitEvent(QueryRecordedEvent.valueOf(message.getPayload(), session.getId()));
}

Expand Down

0 comments on commit ecaf613

Please sign in to comment.