Commit e3cbd33e by qlintonger xeno

眼镜端修复+5

parent 198abd75
...@@ -9,6 +9,7 @@ export class AnyRemote { ...@@ -9,6 +9,7 @@ export class AnyRemote {
infoCB = null infoCB = null
warningCB = null warningCB = null
errorCB = null errorCB = null
messageQueue = []
configureWS(url, tabVisibleCB = () => true, connectionLostCB = () => true, wsSocketChannelName = '') { configureWS(url, tabVisibleCB = () => true, connectionLostCB = () => true, wsSocketChannelName = '') {
this.wsInt = new WSInt(url, this.onMessageGeneral.bind(this), tabVisibleCB, connectionLostCB, wsSocketChannelName) this.wsInt = new WSInt(url, this.onMessageGeneral.bind(this), tabVisibleCB, connectionLostCB, wsSocketChannelName)
...@@ -33,6 +34,20 @@ export class AnyRemote { ...@@ -33,6 +34,20 @@ export class AnyRemote {
} }
sendWSFromCall(toID, msgType, msgData, channelID) { sendWSFromCall(toID, msgType, msgData, channelID) {
if (!this.wsInt) {
this.messageQueue.push({toID, msgType, msgData, channelID})
return
}
if (this.messageQueue.length) {
this.messageQueue.forEach((item) => {
const {toID, msgType, msgData, channelID} = item;
this.wsInt.send({
toID, msgType, msgData, channelID,
fromID: userStates.value.currentUserId,
fromName: userStates.value.currentUserName,
})
})
}
this.wsInt.send({ this.wsInt.send({
fromID: userStates.value.currentUserId, fromID: userStates.value.currentUserId,
fromName: userStates.value.currentUserName, fromName: userStates.value.currentUserName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment