From b5833b2f7ca20fe1c6ae0665526bd3766acf002f Mon Sep 17 00:00:00 2001 From: Jonas Meeuws Date: Thu, 28 Mar 2024 22:27:21 +0100 Subject: [PATCH] Add websocket send example in TeamResource::create() Should close #111 when merged --- src/main/java/telraam/api/TeamResource.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/telraam/api/TeamResource.java b/src/main/java/telraam/api/TeamResource.java index 64201dd..22c36a6 100644 --- a/src/main/java/telraam/api/TeamResource.java +++ b/src/main/java/telraam/api/TeamResource.java @@ -16,6 +16,8 @@ import java.util.Objects; import java.util.Optional; +import telraam.websocket.WebSocketMessageSingleton; + @Path("/team") @Tag(name="Team") @@ -48,6 +50,14 @@ public int create(Team team) { )); } + WebSocketMessageSingleton.getInstance().sendToAll( + "new team (%s, %s, %s)".formatted( + team.getName(), + team.getId(), + team.getBatonId() + ) + ); + return ret; }