feat: 新增导出中心功能

This commit is contained in:
taojinlong 2024-05-28 10:12:31 +08:00
parent 8a706bd560
commit 39659fb479

View File

@ -12,24 +12,24 @@ export default {
} }
] ]
const socket = new SockJS('http://localhost:8100' + '/websocket' + '?userId=1') // const socket = new SockJS('http://localhost:8100' + '/websocket' + '?userId=1')
stompClient = Stomp.over(socket) // stompClient = Stomp.over(socket)
const heads = { // const heads = {
userId: 1 // userId: 1
} // }
stompClient.connect( // stompClient.connect(
heads, // heads,
res => { // res => {
console.log('连接成功: ' + res) // console.log('连接成功: ' + res)
channels.forEach(channel => { // channels.forEach(channel => {
stompClient.subscribe('/user/' + 1 + channel.topic, res => { // stompClient.subscribe('/user/' + 1 + channel.topic, res => {
res && res.body && eventBus.emit(channel.event, res.body) // res && res.body && eventBus.emit(channel.event, res.body)
}) // })
}) // })
}, // },
error => { // error => {
console.log('连接失败: ' + error) // console.log('连接失败: ' + error)
} // }
) // )
} }
} }