fix: reconnect while disconnect only while error
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vocechat-web",
|
||||
"version": "0.3.12",
|
||||
"version": "0.3.14",
|
||||
"private": true,
|
||||
"homepage": "https://voce.chat",
|
||||
"dependencies": {
|
||||
|
||||
+8
-8
@@ -20,14 +20,14 @@ let prices = [
|
||||
export const LicensePriceList =
|
||||
process.env.NODE_ENV === "development"
|
||||
? [
|
||||
...prices,
|
||||
{
|
||||
title: "VoceChat Enterprise",
|
||||
limit: 99999,
|
||||
pid: "price_1LkQGpGGoUDRyc3jGTh3GYHw",
|
||||
desc: "test price"
|
||||
}
|
||||
]
|
||||
...prices,
|
||||
{
|
||||
title: "VoceChat Enterprise",
|
||||
limit: 99999,
|
||||
pid: "price_1LkQGpGGoUDRyc3jGTh3GYHw",
|
||||
desc: "test price"
|
||||
}
|
||||
]
|
||||
: prices;
|
||||
export const PAYMENT_URL_PREFIX =
|
||||
process.env.NODE_ENV === "production"
|
||||
|
||||
@@ -82,9 +82,19 @@ export default function useStreaming() {
|
||||
initialized = true;
|
||||
};
|
||||
SSE.onerror = (err) => {
|
||||
console.error("sse error", err);
|
||||
|
||||
const { readyState } = err.target as EventSource;
|
||||
console.error("sse error", readyState);
|
||||
// 连接还处于开启或正在连接状态
|
||||
if (readyState === EventSource.OPEN || readyState === EventSource.CONNECTING) {
|
||||
return;
|
||||
}
|
||||
initializing = false;
|
||||
// 正常的关闭
|
||||
if (readyState === EventSource.CLOSED) {
|
||||
initialized = false;
|
||||
return;
|
||||
}
|
||||
// 非正常状态,目前未知
|
||||
stopStreaming();
|
||||
if (inter) {
|
||||
clearTimeout(inter);
|
||||
|
||||
Reference in New Issue
Block a user