feat: 新增websocket测试页面(实验阶段)

Former-commit-id: 8c5a49f95da85f6a245d9a3cc60d5f925cfc0861
This commit is contained in:
郝先瑞
2023-06-03 11:12:17 +08:00
parent dfcface95d
commit 68cb0ee20a
5 changed files with 159 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
* 登录用户信息
*/
export interface UserInfo {
userId: number;
nickname: string;
avatar: string;
roles: string[];

View File

@@ -0,0 +1,27 @@
import request from "@/utils/request";
/**
* 发送消息给所有人
*
* @param file
*/
export function sendToAll(message: string) {
return request({
url: "/websocket/sendToAll",
method: "post",
params: { message: message },
});
}
/**
* 发送消息给指定用户
*
* @param
*/
export function sendToUser(userId: number, message: string) {
return request({
url: "/websocket/sendToUser/" + userId,
method: "post",
params: { message: message },
});
}