feat(websocket): 实现基于Redis的消息队列WebSocket通信功能
- 添加Redis消息队列配置类RedisMessageConfig,实现消息监听容器 - 重构KitWsMessage消息结构,将数据字段改为内部Data类并添加getter/setter - 集成RedisTemplate实现WebSocket消息发布功能,支持主动推送和实时聊天 - 实现WsMessageSubscriber消息订阅者,处理来自Redis的消息队列数据 - 添加WebSocket业务代码常量接口KitWsBizCodeConst - 更新前端Demo组件适配新的消息格式和业务代码参数 - 优化WebSocket服务器端消息处理逻辑和错误处理机制
This commit is contained in:
@@ -63,19 +63,19 @@ export default {
|
||||
console.info('=============== KitWsClient:event', event)
|
||||
}, function(msgEvent) {
|
||||
console.info('=============== KitWsClient:msgEvent', msgEvent)
|
||||
that.responseTxt = that.responseTxt + msgEvent.data + ''
|
||||
that.responseTxt = that.responseTxt + msgEvent.data + '\n'
|
||||
})
|
||||
},
|
||||
onSendClick() {
|
||||
if (this.client) {
|
||||
this.client.sendData({
|
||||
msgType: 'sc',
|
||||
userIds: ['123456'],
|
||||
content: this.sendVal
|
||||
})
|
||||
this.client.sendData({
|
||||
msgType: 'gc',
|
||||
content: this.sendVal
|
||||
const that = this
|
||||
if (that.client) {
|
||||
that.client.sendData({
|
||||
bizCode: '101',
|
||||
data: {
|
||||
fromUsername: that.user.username,
|
||||
toUsername: null,
|
||||
message: that.sendVal
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user