rename user 'uuid' to 'usid'
This commit is contained in:
parent
ac76575e4f
commit
6c798bcd00
@ -30,8 +30,8 @@ module.exports = {
|
||||
}
|
||||
if (dataObj.skevent === 'SOCKET_OWNER') {
|
||||
dataObj._passtokenSource = webtoken.verifyToken(dataObj._passtoken) // todo: 为防止前端欺骗,应当用和login里类似的方法来检查来检查
|
||||
if (typeof dataObj._passtokenSource?.uuid === 'string') {
|
||||
my.socketPool[dataObj._passtokenSource.uuid] = socket
|
||||
if (typeof dataObj._passtokenSource?.usid === 'string') {
|
||||
my.socketPool[dataObj._passtokenSource.usid] = socket
|
||||
console.log('收到 Login 成功的消息,绑定socket', Object.keys(my.socketPool))
|
||||
}
|
||||
}
|
||||
@ -55,8 +55,8 @@ module.exports = {
|
||||
return this
|
||||
},
|
||||
|
||||
removeUserSocket (uuid) {
|
||||
delete my.socketPool[uuid]
|
||||
removeUserSocket (usid) {
|
||||
delete my.socketPool[usid]
|
||||
},
|
||||
|
||||
addListener (skevent, listener) {
|
||||
@ -73,17 +73,17 @@ module.exports = {
|
||||
if (socket.readyState === socket.OPEN) {
|
||||
socket.send(typeof dataObj !== 'string' ? JSON.stringify(dataObj) : dataObj)
|
||||
} else {
|
||||
delete my.socketPool[socket.uuid]
|
||||
delete my.socketPool[socket.usid]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
sendToOne (dataObj, uuid) {
|
||||
const socket = my.socketPool[uuid]
|
||||
sendToOne (dataObj, usid) {
|
||||
const socket = my.socketPool[usid]
|
||||
if (socket && socket.readyState === socket.OPEN) {
|
||||
socket.send(typeof dataObj !== 'string' ? JSON.stringify(dataObj) : dataObj)
|
||||
} else {
|
||||
delete my.socketPool[uuid]
|
||||
delete my.socketPool[usid]
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user