From 44654d74c8cd00ee3dfde0a6999a2caf8d3f863c Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <daniel.gerhardt@mni.thm.de> Date: Fri, 8 Mar 2013 09:53:01 +0100 Subject: [PATCH] Send all relevant data to client when the session is changed via Socket.IO. --- .../arsnova/socket/ARSnovaSocketIOServer.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java index 5e5eb9ee..9ce63e7f 100644 --- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java +++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java @@ -105,6 +105,7 @@ public class ARSnovaSocketIOServer { public void onData(SocketIOClient client, Session session, AckRequest ackSender) { userService.addUserToSessionBySocketId(client.getSessionId(), session.getKeyword()); reportActiveUserCountForSession(session.getKeyword()); + reportSessionDataToClient(session.getKeyword(), client); } }); @@ -216,6 +217,21 @@ public class ARSnovaSocketIOServer { return result; } + /** + * Currently only sends the feedback data to the client. Should be used for all + * relevant Socket.IO data, the client needs to know after joining a session. + * + * @param sessionKey + * @param client + */ + public void reportSessionDataToClient(String sessionKey, SocketIOClient client) { + de.thm.arsnova.entities.Feedback fb = feedbackService.getFeedback(sessionKey); + client.sendEvent("updateFeedback", fb.getValues()); + + /* updateActiveUserCount does not need to be send since it is broadcasted + * after the client joined the session */ + } + public void reportUpdatedFeedbackForSession(String sessionKey) { de.thm.arsnova.entities.Feedback fb = feedbackService.getFeedback(sessionKey); broadcastInSession(sessionKey, "updateFeedback", fb.getValues()); -- GitLab