| | |
| | | |
| | | import cn.flightfeather.supervision.common.log.BizLog |
| | | import cn.flightfeather.supervision.common.log.WorkStreamLogInfo |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.socket.WebSocketMessage |
| | | import cn.flightfeather.supervision.socket.WebSocketMessageParser |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * webSocket消息接收管理 |
| | |
| | | * @author feiyu02 |
| | | */ |
| | | @Component |
| | | class WebSocketReceiver(private val bizLog: BizLog) { |
| | | class WebSocketReceiver(private val bizLog: BizLog, private val webSocketSender: WebSocketSender) { |
| | | |
| | | /** |
| | | * 接收消息处理 |
| | |
| | | bizLog.info(WorkStreamLogInfo("8FAqSPnAA8ry4ExX", "朱正强", "在上海广发粉煤灰有限公司新增一个问题")) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 接收心跳消息处理 |
| | | */ |
| | | fun onReceiveHeartMsg(msg: String, sessionId: String) { |
| | | val content = WebSocketMessageParser.encodeMessage(WebSocketMessage(Constant.SocketHeartMessageType.HEART_MESSAGE_TYPE.value, |
| | | LocalDateTime.now())) |
| | | webSocketSender.sendMsg(content, sessionId) |
| | | } |
| | | } |