update 优化 调整默认推送使用SSE
This commit is contained in:
parent
ee3525cfb2
commit
d5ab2a7557
@ -24,9 +24,9 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|||||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
import org.dromara.common.social.config.properties.SocialProperties;
|
||||||
import org.dromara.common.social.utils.SocialUtils;
|
import org.dromara.common.social.utils.SocialUtils;
|
||||||
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
|
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.common.websocket.dto.WebSocketMessageDto;
|
|
||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
|
||||||
import org.dromara.system.domain.bo.SysTenantBo;
|
import org.dromara.system.domain.bo.SysTenantBo;
|
||||||
import org.dromara.system.domain.vo.SysClientVo;
|
import org.dromara.system.domain.vo.SysClientVo;
|
||||||
import org.dromara.system.domain.vo.SysTenantVo;
|
import org.dromara.system.domain.vo.SysTenantVo;
|
||||||
@ -102,11 +102,11 @@ public class AuthController {
|
|||||||
|
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
WebSocketMessageDto dto = new WebSocketMessageDto();
|
SseMessageDto dto = new SseMessageDto();
|
||||||
dto.setMessage("欢迎登录RuoYi-Vue-Plus后台管理系统");
|
dto.setMessage("欢迎登录RuoYi-Vue-Plus后台管理系统");
|
||||||
dto.setSessionKeys(List.of(userId));
|
dto.setUserIds(List.of(userId));
|
||||||
WebSocketUtils.publishMessage(dto);
|
SseMessageUtils.publishMessage(dto);
|
||||||
}, 3, TimeUnit.SECONDS);
|
}, 20, TimeUnit.SECONDS);
|
||||||
return R.ok(loginVo);
|
return R.ok(loginVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,10 +256,15 @@ management:
|
|||||||
logfile:
|
logfile:
|
||||||
external-file: ./logs/sys-console.log
|
external-file: ./logs/sys-console.log
|
||||||
|
|
||||||
|
--- # 默认/推荐使用sse推送
|
||||||
|
sse:
|
||||||
|
enabled: true
|
||||||
|
path: /resource/sse
|
||||||
|
|
||||||
--- # websocket
|
--- # websocket
|
||||||
websocket:
|
websocket:
|
||||||
# 如果关闭 需要和前端开关一起关闭
|
# 如果关闭 需要和前端开关一起关闭
|
||||||
enabled: true
|
enabled: false
|
||||||
# 路径
|
# 路径
|
||||||
path: /resource/websocket
|
path: /resource/websocket
|
||||||
# 设置访问源地址
|
# 设置访问源地址
|
||||||
|
@ -8,8 +8,8 @@ import org.dromara.common.log.annotation.Log;
|
|||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
|
||||||
import org.dromara.system.domain.bo.SysNoticeBo;
|
import org.dromara.system.domain.bo.SysNoticeBo;
|
||||||
import org.dromara.system.domain.vo.SysNoticeVo;
|
import org.dromara.system.domain.vo.SysNoticeVo;
|
||||||
import org.dromara.system.service.ISysNoticeService;
|
import org.dromara.system.service.ISysNoticeService;
|
||||||
@ -62,7 +62,7 @@ public class SysNoticeController extends BaseController {
|
|||||||
return R.fail();
|
return R.fail();
|
||||||
}
|
}
|
||||||
String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType());
|
String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType());
|
||||||
WebSocketUtils.publishAll("[" + type + "] " + notice.getNoticeTitle());
|
SseMessageUtils.publishAll("[" + type + "] " + notice.getNoticeTitle());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user