Ver código fonte

add
创建长期记忆体

lifang 3 meses atrás
pai
commit
280280f12f

+ 1 - 1
tr-modules/tr-module-mobile/src/main/java/cn/tr/module/mobile/ServerEventListenerImpl.java

@@ -83,7 +83,7 @@ public class ServerEventListenerImpl implements ServerEventListener {
     public boolean onTransferMessage4C2SBefore(Protocal p, Channel session) {
         log.debug("收到C2S消息前处理: from={}, to={}, fp={}, typeu={}, dataContent={}",
                 p.getFrom(), p.getTo(), p.getFp(), p.getTypeu(),p.getDataContent());
-        return true;
+        return false;
     }
     /**
      * 收到客户端发送给“其它客户端”的数据回调通知(即:消息路径为“C2C”的消息)前的处理逻辑。

+ 26 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/app/controller/SseController.java

@@ -0,0 +1,26 @@
+package cn.tr.module.smart.app.controller;
+
+import cn.dev33.satoken.annotation.SaIgnore;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.PostConstruct;
+import java.time.LocalTime;
+import java.util.stream.Stream;
+
+@RestController
+@SaIgnore
+public class SseController {
+
+    @PostConstruct
+    public void init(){
+        System.out.println("123");
+    }
+    @GetMapping(value = "/sse/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
+    public Stream<String> stream() {
+        // 模拟数据流
+        return Stream.generate(() -> "当前时间:" + LocalTime.now())
+                     .limit(10); // 限制10条消息
+    }
+}

+ 1 - 0
tr-test/src/main/resources/application.yml

@@ -61,6 +61,7 @@ tr:
       - /webjars/**
       - /oauth2/psw/**
       - /download/file/**
+      - /sse/stream
   tenant:
     ignore-tables:
       - gen_config