Compare commits
1 commit
e5cf6d291a
...
52616e6a6a
Author | SHA1 | Date | |
---|---|---|---|
52616e6a6a |
3 changed files with 6 additions and 5 deletions
|
@ -22,12 +22,11 @@ public class ConnectionWebsocketHandler extends JsonWebsocketHandler {
|
||||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
||||||
try{
|
try{
|
||||||
String payload = message.getPayload();
|
String payload = message.getPayload();
|
||||||
switch ( objectMapper.readTree(payload).get("$id").asText().toLowerCase()) {
|
switch ( objectMapper.readTree(payload).get("$id").asText()) {
|
||||||
case "requestconnectiontoken" -> handleRequestConnectionToken(session, payload);
|
case RequestConnectionTokenMessage.MESSAGE_ID -> handleRequestConnectionToken(session, payload);
|
||||||
default -> this.closeSession(session, CloseStatus.BAD_DATA);
|
default -> this.closeSession(session, CloseStatus.BAD_DATA);
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception ignored) {
|
||||||
System.out.println(exception.getMessage());
|
|
||||||
this.closeSession(session, CloseStatus.BAD_DATA);
|
this.closeSession(session, CloseStatus.BAD_DATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import lombok.*;
|
||||||
@Data
|
@Data
|
||||||
@NotNull
|
@NotNull
|
||||||
public class RequestConnectionTokenMessage {
|
public class RequestConnectionTokenMessage {
|
||||||
|
public static final String MESSAGE_ID = "RequestConnectionToken";
|
||||||
|
|
||||||
@JsonProperty("$id")
|
@JsonProperty("$id")
|
||||||
private String messageId;
|
private String messageId;
|
||||||
private Channel channel;
|
private Channel channel;
|
||||||
|
|
|
@ -7,7 +7,7 @@ info:
|
||||||
Because of the limitations of Async API, we expect that the actual json,
|
Because of the limitations of Async API, we expect that the actual json,
|
||||||
which is send as payload to always contain a field called `$id` with
|
which is send as payload to always contain a field called `$id` with
|
||||||
the corresponding `messageId`. <br>
|
the corresponding `messageId`. <br>
|
||||||
The `messageId` should be handled case insensitive.
|
The `messageId` should be handled case sensitive.
|
||||||
defaultContentType: application/json
|
defaultContentType: application/json
|
||||||
servers:
|
servers:
|
||||||
localhost:
|
localhost:
|
||||||
|
|
Loading…
Add table
Reference in a new issue