管理端登录报错修复
This commit is contained in:
@@ -273,7 +273,7 @@ export class StompWebSocketService {
|
||||
private subscribeToMessages(): void {
|
||||
if (!this.client?.connected) return
|
||||
|
||||
// 订阅用户私有消息
|
||||
// 订阅用户私有消息 - 这是主要的消息接收频道
|
||||
if (this.userId) {
|
||||
const userQueuePath = `/user/${this.userId}/queue/messages`
|
||||
console.log('📨 订阅用户私有队列:', userQueuePath)
|
||||
@@ -283,17 +283,18 @@ export class StompWebSocketService {
|
||||
})
|
||||
}
|
||||
|
||||
// 订阅广播消息
|
||||
// 订阅广播消息(系统通知等)
|
||||
this.client.subscribe('/topic/broadcast', (message: IMessage) => {
|
||||
this.handleMessage(message)
|
||||
})
|
||||
|
||||
// 如果有会话ID,订阅会话特定消息
|
||||
if (this.conversationId) {
|
||||
this.client.subscribe(`/topic/conversation/${this.conversationId}`, (message: IMessage) => {
|
||||
this.handleMessage(message)
|
||||
})
|
||||
}
|
||||
// 注释掉会话特定消息订阅,避免重复接收消息
|
||||
// 所有消息都通过用户私有队列接收,确保消息不重复
|
||||
// if (this.conversationId) {
|
||||
// this.client.subscribe(`/topic/conversation/${this.conversationId}`, (message: IMessage) => {
|
||||
// this.handleMessage(message)
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user