improvements
This commit is contained in:
@@ -123,14 +123,14 @@ public class GameWebSocketHandler extends TextWebSocketHandler {
|
||||
"snapshot",
|
||||
gameRoomService.getSnapshot(roomId, participantId)
|
||||
);
|
||||
synchronized (session) {
|
||||
synchronized (sessions.get(session.getId())) {
|
||||
session.sendMessage(new TextMessage(objectMapper.writeValueAsString(message)));
|
||||
}
|
||||
}
|
||||
|
||||
private void sendError(WebSocketSession session, String errorMessage) throws IOException {
|
||||
ErrorMessage message = new ErrorMessage("error", errorMessage);
|
||||
synchronized (session) {
|
||||
synchronized (sessions.get(session.getId())) {
|
||||
session.sendMessage(new TextMessage(objectMapper.writeValueAsString(message)));
|
||||
}
|
||||
}
|
||||
@@ -150,10 +150,10 @@ public class GameWebSocketHandler extends TextWebSocketHandler {
|
||||
|
||||
private String requiredText(JsonNode payload, String fieldName) {
|
||||
JsonNode value = payload.get(fieldName);
|
||||
if (value == null || value.asText().isBlank()) {
|
||||
if (value == null || value.asString().isBlank()) {
|
||||
throw new GameRoomService.GameException("Feld " + fieldName + " fehlt.");
|
||||
}
|
||||
return value.asText();
|
||||
return value.asString();
|
||||
}
|
||||
|
||||
private int requiredInt(JsonNode payload, String fieldName) {
|
||||
|
||||
@@ -144,6 +144,7 @@ async function enterRoom(payload) {
|
||||
window.history.replaceState({}, "", `${window.location.pathname}?${params.toString()}`);
|
||||
render();
|
||||
connectSocket(true);
|
||||
document.querySelector('.hero-card').hidden = true;
|
||||
}
|
||||
|
||||
function connectSocket(forceReconnect = false) {
|
||||
|
||||
@@ -23,7 +23,7 @@ body {
|
||||
color: var(--ink);
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(214, 164, 58, 0.22), transparent 28%),
|
||||
radial-gradient(circle at top right, rgba(41, 108, 168, 0.18), transparent 26%),
|
||||
radial-gradient(circle at top right, rgba(41, 108, 168, 0.18), transparent 26%),a
|
||||
linear-gradient(180deg, #efe2c4 0%, #f7f2e7 44%, #e8eef4 100%);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,9 @@ h1 {
|
||||
.board-column {
|
||||
display: grid;
|
||||
gap: 1.25rem;
|
||||
align-items: start;
|
||||
justify-items: stretch;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.panel {
|
||||
|
||||
Reference in New Issue
Block a user