| | |
| | | package org.dromara.common.sse.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaIgnore; |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.sse.core.SseEmitterManager; |
| | | import org.dromara.common.sse.dto.SseMessageDto; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @ConditionalOnProperty(value = "sse.enabled", havingValue = "true") |
| | | @RequiredArgsConstructor |
| | | public class SseController { |
| | | |
| | |
| | | return sseEmitterManager.connect(userId, tokenValue); |
| | | } |
| | | |
| | | @SaIgnore |
| | | @GetMapping(value = "${sse.path}/close") |
| | | public R<Void> close() { |
| | | String tokenValue = StpUtil.getTokenValue(); |