update:新增个人训练重连机制,修复海报
This commit is contained in:
+17
-1
@@ -849,6 +849,7 @@ export function connectMatchWebSocket(options = {}) {
|
||||
token,
|
||||
mode,
|
||||
requestPracticeInfoOnOpen = false,
|
||||
appHideResumable = false,
|
||||
force = false,
|
||||
reconnecting = false,
|
||||
reconnectReason = "",
|
||||
@@ -920,6 +921,7 @@ export function connectMatchWebSocket(options = {}) {
|
||||
isMelee:
|
||||
Number.isFinite(normalizedMode) ? normalizedMode > 3 : undefined,
|
||||
requestPracticeInfoOnOpen: requestPracticeInfoOnOpen === true,
|
||||
appHideResumable: appHideResumable === true,
|
||||
meleeHalfRest: isSameContext
|
||||
? currentContext?.meleeHalfRest === true
|
||||
: false,
|
||||
@@ -1016,9 +1018,22 @@ export function connectMatchWebSocketFromNotice(notice, fallbackUserId) {
|
||||
});
|
||||
}
|
||||
|
||||
export function setMatchAppHideResumable(enabled) {
|
||||
if (!currentContext) return;
|
||||
currentContext.appHideResumable = enabled === true;
|
||||
}
|
||||
|
||||
export function closeMatchWebSocket(options = {}) {
|
||||
// 默认关闭时会发送 LEAVE;内部切换连接可通过 sendLeave:false 跳过。
|
||||
const { sendLeave: shouldSendLeave = true, reason = "manual" } = options;
|
||||
const { reason = "manual" } = options;
|
||||
// 可恢复训练切后台只断开传输层,不能把它上报成主动离场。
|
||||
const shouldSendLeave =
|
||||
options.sendLeave === undefined
|
||||
? !(
|
||||
reason === "app-hide" &&
|
||||
currentContext?.appHideResumable === true
|
||||
)
|
||||
: options.sendLeave === true;
|
||||
|
||||
manualClose = true;
|
||||
clearReconnectTimer();
|
||||
@@ -1051,6 +1066,7 @@ export default {
|
||||
ServerMessageType,
|
||||
connectMatchWebSocket,
|
||||
connectMatchWebSocketFromNotice,
|
||||
setMatchAppHideResumable,
|
||||
closeMatchWebSocket,
|
||||
forceReconnectMatchWebSocket,
|
||||
handleMatchNetworkStatusChange,
|
||||
|
||||
Reference in New Issue
Block a user