aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Service.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Service.java b/juick-server/src/main/java/com/juick/server/api/Service.java
index 2351c076..ecfc6957 100644
--- a/juick-server/src/main/java/com/juick/server/api/Service.java
+++ b/juick-server/src/main/java/com/juick/server/api/Service.java
@@ -1,5 +1,6 @@
package com.juick.server.api;
+import com.juick.Message;
import com.juick.User;
import com.juick.server.CommandsManager;
import com.juick.server.EmailManager;
@@ -137,9 +138,12 @@ public class Service {
}
}
@GetMapping("/api/events")
- public SseEmitter handle() {
+ public SseEmitter handle() throws IOException {
logger.info("{} connected", UserUtils.getCurrentUser().getName());
SseEmitter emitter = new SseEmitter(86400000L);
+ Message service = new Message();
+ service.setService(true);
+ emitter.send(service);
serverManager.getSessions().add(new ServerManager.EventSession(UserUtils.getCurrentUser(), emitter));
emitter.onCompletion(() -> serverManager.getSessions().remove(emitter));