Skip to content

Commit

Permalink
fix backend
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreKoepke committed Feb 22, 2025
1 parent 27671cf commit 856f651
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void deregisterSession(String sessionId) {
}

public void broadcast(Object message) {
sessions.values().forEach(session -> sendMessage(session, message));
sessions.keySet().forEach(sessionId -> sendMessage(sessionId, message));
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void updateLight(String updatedDeviceId) {
public void onOpen(Session session) {
log.info("Opening session: {}", session.getId());
registerSession(session);
sendAllLightsToSession(session);
sendAllLightsToSession(session.getId());
}

@OnClose
Expand All @@ -54,10 +54,10 @@ public void onError(Session session, Throwable throwable) {
}

@SneakyThrows
private void sendAllLightsToSession(Session session) {
private void sendAllLightsToSession(String sessionId) {
deviceService.getDevicesOfType(SimpleLight.class)
.stream()
.map(ActorDto::from)
.forEach(motionSensor -> sendMessage(session, motionSensor));
.forEach(motionSensor -> sendMessage(sessionId, motionSensor));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void updateSensor(String updatedDeviceId) {
public void onOpen(Session session) {
log.info("Opening session: {}", session.getId());
registerSession(session);
sendAllSensorsToSession(session);
sendAllSensorsToSession(session.getId());
}

@OnClose
Expand All @@ -54,10 +54,10 @@ public void onError(Session session, Throwable throwable) {
}

@SneakyThrows
private void sendAllSensorsToSession(Session session) {
private void sendAllSensorsToSession(String sessionId) {
deviceService.getDevicesOfType(MotionSensor.class)
.stream()
.map(SensorDto::from)
.forEach(motionSensor -> sendMessage(session, motionSensor));
.forEach(motionSensor -> sendMessage(sessionId, motionSensor));
}
}

0 comments on commit 856f651

Please sign in to comment.