|
@@ -7,6 +7,8 @@ import com.baomidou.kisso.annotation.Permission;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
@@ -26,14 +28,14 @@ public class SysSSEController extends ApiController {
|
|
|
|
|
|
@Operation(summary = "连接")
|
|
|
@Permission("sys:sse:connect")
|
|
|
- @RequestMapping("/connect")
|
|
|
+ @GetMapping(value = "/connect", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
|
|
public SseEmitter connect() {
|
|
|
return sseService.connect();
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "测试发送数据给当前用户")
|
|
|
@Permission("sys:sse:testSend")
|
|
|
- @RequestMapping("/test-send")
|
|
|
+ @GetMapping("/test-send")
|
|
|
public boolean sendTest(String message) {
|
|
|
sseService.send(UserSession.getLoginInfo().getId(), "message", message);
|
|
|
return true;
|