增加获取ws-url接口

pull/3/head
liuhanqing 2021-02-03 21:31:55 +08:00
parent a9ea69b782
commit 66792a9166
5 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1 @@
websocket业务模块

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-s-message</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>message-business-websocket</artifactId>
<packaging>jar</packaging>
<dependencies>
<!--auth鉴权模块的api-->
<!--需要用auth模块的LoginContext获取当前登录用户然后返回ws-url-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>auth-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--资源api模块-->
<!--用在资源控制器,资源扫描上-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>scanner-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--参数校验模块-->
<!--用在控制器,参数校验-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>validator-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--web模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,33 @@
package cn.stylefeng.roses.kernel.message.modular.websocket.controller;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RestController;
/**
* websocket
*
* @author liuhanqing
* @date 2021/2/3 21:08
*/
@RestController
@ApiResource(name = "webSocket控制器")
public class WebSocketController {
/**
* ws-url
*
* @author liuhanqing
* @date 2021/2/3 21:15
*/
@GetResource(name = "获取登录用户ws-url", path = "/webSocket/getWsUrl")
public ResponseData getWsUrl() {
LoginUser loginUser = LoginContext.me().getLoginUser();
return new SuccessResponseData(loginUser.getWsUrl());
}
}

View File

@ -25,6 +25,14 @@
</dependency>
<!--websocket管理-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>message-business-websocket</artifactId>
<version>1.0.0</version>
</dependency>
<!--消息默认记录到库中-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>

View File

@ -18,6 +18,7 @@
<modules>
<module>message-api</module>
<module>message-business</module>
<module>message-business-websocket</module>
<module>message-sdk-db</module>
<module>message-sdk-websocket</module>
<module>message-spring-boot-starter</module>