feat: 新增首页统计接口

This commit is contained in:
ray
2024-06-30 23:56:22 +08:00
parent 22073364f1
commit 6e12d10120
12 changed files with 265 additions and 11 deletions

View File

@@ -20,13 +20,14 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* WebSocket 配置
* WebSocket 自动配置
*
* @author haoxr
* @since 2.4.0
*/
// 启用WebSocket消息代理功能和配置STOMP协议实现实时双向通信和消息传递
@EnableWebSocketMessageBroker
@Configuration
@EnableWebSocketMessageBroker // 启用WebSocket消息代理功能和配置STOMP协议实现实时双向通信和消息传递
@Slf4j
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@@ -36,9 +37,12 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry
.addEndpoint("/ws") // 注册了一个 /ws 的端点
.setAllowedOriginPatterns("*") // 允许跨域的 WebSocket 连接
.withSockJS(); // 启用 SockJS (浏览器不支持WebSocketSockJS 将会提供兼容性支持)
// 注册 /ws 的端点
.addEndpoint("/ws")
// 允许跨域的 WebSocket 连接
.setAllowedOriginPatterns("*")
// 启用 SockJS (浏览器不支持WebSocketSockJS 将会提供兼容性支持)
.withSockJS();
registry.addEndpoint("/ws-app").setAllowedOriginPatterns("*"); // 注册了一个 /ws-app 的端点,支持 uni-app 的 ws 连接协议
}