增加报警数据websocket 消息推送
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package org.dromara.resource.api;
|
||||
|
||||
import org.dromara.resource.api.domain.WebSocketMsgType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* websocket 消息推送
|
||||
*
|
||||
* @author lxj
|
||||
*/
|
||||
public interface RemoteWebSocketMessageService {
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param sessionKey session主键 一般为用户id
|
||||
* @param webSocketMsgType webSocket消息类型
|
||||
* @param data 消息数据
|
||||
*/
|
||||
void publishMessage(List<Long> sessionKey, WebSocketMsgType webSocketMsgType, Object data);
|
||||
|
||||
/**
|
||||
* 发布订阅的消息(群发)
|
||||
*
|
||||
* @param webSocketMsgType webSocket消息类型
|
||||
* @param data 消息数据
|
||||
*/
|
||||
void publishAll(WebSocketMsgType webSocketMsgType, Object data);
|
||||
|
||||
/**
|
||||
* 向指定的用户的指定会话发送消息
|
||||
*
|
||||
* @param userId 要发送消息的用户id
|
||||
* @param webSocketMsgType webSocket消息类型
|
||||
* @param data 消息数据
|
||||
*/
|
||||
void sendMessage(Long userId, WebSocketMsgType webSocketMsgType, Object data);
|
||||
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package org.dromara.resource.api.domain;
|
||||
|
||||
/**
|
||||
* websocket 消息推送类型枚举
|
||||
*
|
||||
* @author lxj
|
||||
*/
|
||||
public enum WebSocketMsgType {
|
||||
|
||||
ALARM_MSG(100);
|
||||
|
||||
/**
|
||||
* 消息类型编码
|
||||
* 大类型 - 100,200,300,400 累加100
|
||||
* 小类型 - 101, 102, 103 累加1
|
||||
*/
|
||||
private final Integer code;
|
||||
|
||||
WebSocketMsgType(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user