summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/luxons/sevenwonders/WebSocketConfig.java2
-rw-r--r--src/main/java/org/luxons/sevenwonders/controllers/LobbyController.java11
-rw-r--r--src/main/java/org/luxons/sevenwonders/controllers/TestController.java4
3 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/WebSocketConfig.java b/src/main/java/org/luxons/sevenwonders/WebSocketConfig.java
index bbe91c16..b0613e79 100644
--- a/src/main/java/org/luxons/sevenwonders/WebSocketConfig.java
+++ b/src/main/java/org/luxons/sevenwonders/WebSocketConfig.java
@@ -13,7 +13,7 @@ public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
// prefixes for all subscriptions
- config.enableSimpleBroker("/broadcast", "/queue", "/topic");
+ config.enableSimpleBroker("/queue", "/topic");
config.setUserDestinationPrefix("/user");
// prefix for all calls from clients
diff --git a/src/main/java/org/luxons/sevenwonders/controllers/LobbyController.java b/src/main/java/org/luxons/sevenwonders/controllers/LobbyController.java
index 8e4f93c1..705e6ef2 100644
--- a/src/main/java/org/luxons/sevenwonders/controllers/LobbyController.java
+++ b/src/main/java/org/luxons/sevenwonders/controllers/LobbyController.java
@@ -15,7 +15,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.stereotype.Controller;
@Controller
-//@MessageMapping("/lobby")
+@MessageMapping("/lobby")
public class LobbyController {
private final GameDefinitionLoader gameDefinitionLoader;
@@ -32,21 +32,22 @@ public class LobbyController {
}
@MessageMapping("/create-game")
- @SendTo("/broadcast/games")
+ @SendTo("/topic/games")
public String createGame(SimpMessageHeaderAccessor headerAccessor) throws Exception {
System.out.println("Received message: " + headerAccessor.getSessionId());
Thread.sleep(1000); // simulated delay
- String id = String.valueOf(lastGameId++);
+ long newId = lastGameId++;
+ String id = String.valueOf(newId);
System.out.println("Creating game " + id);
- Lobby lobby = new Lobby(lastGameId, gameDefinitionLoader.getGameDefinition());
+ Lobby lobby = new Lobby(newId, gameDefinitionLoader.getGameDefinition());
lobbies.put(id, lobby);
return id;
}
@MessageMapping("/join-game")
- @SendTo("/broadcast/players")
+ @SendTo("/topic/players")
public Player joinGame(SimpMessageHeaderAccessor headerAccessor, JoinGameAction joinAction) throws Exception {
Thread.sleep(1000); // simulated delay
diff --git a/src/main/java/org/luxons/sevenwonders/controllers/TestController.java b/src/main/java/org/luxons/sevenwonders/controllers/TestController.java
index 06ebbdf3..0fd9e0c1 100644
--- a/src/main/java/org/luxons/sevenwonders/controllers/TestController.java
+++ b/src/main/java/org/luxons/sevenwonders/controllers/TestController.java
@@ -52,8 +52,8 @@ public class TestController {
return "success test5";
}
- // sent to the caller user if he subscribed to /user/queue/test5
- // other subscribers of /user/queue/test5 are NOT notified
+ // sent to the caller user if he subscribed to /user/queue/test6
+ // other subscribers of /user/queue/test6 are NOT notified
@MessageMapping("/test6")
// TODO
public String test6(SimpMessageHeaderAccessor headerAccessor) throws Exception {
bgstack15