Fixed frontend ws session onclose handling.

This commit is contained in:
yflu 2022-10-25 23:02:39 +08:00
parent 486c46f608
commit 4e0f7b52d4
3 changed files with 6 additions and 5 deletions

View File

@ -440,7 +440,7 @@
"array": [
0,
0,
216.05530045313827,
344.75930058781137,
0,
0,
0,

View File

@ -253,8 +253,8 @@ cc.Class({
if (null != window.handleBattleColliderInfo) {
window.handleBattleColliderInfo = null;
}
if (null != window.handleClientSessionCloseOrError) {
window.handleClientSessionCloseOrError = null;
if (null != window.handleClientSessionError) {
window.handleClientSessionError = null;
}
},
@ -349,8 +349,8 @@ cc.Class({
window.forceBigEndianFloatingNumDecoding = self.forceBigEndianFloatingNumDecoding;
console.warn("+++++++ Map onLoad()");
window.handleClientSessionCloseOrError = function() {
console.warn('+++++++ Common handleClientSessionCloseOrError()');
window.handleClientSessionError = function() {
console.warn('+++++++ Common handleClientSessionError()');
if (ALL_BATTLE_STATES.IN_SETTLEMENT == self.battleState) {
console.log("Battled ended by settlement");

View File

@ -224,6 +224,7 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
case constants.RET_CODE.MYSQL_ERROR:
case constants.RET_CODE.PLAYER_NOT_FOUND:
case constants.RET_CODE.PLAYER_CHEATING:
case 1006: // Peer(i.e. the backend) gone unexpectedly
if (window.handleClientSessionError) {
window.handleClientSessionError();
}