chore: updates

This commit is contained in:
Tristan Yang
2023-07-26 16:36:12 +08:00
parent 927a3b7075
commit 32b4793aed
3 changed files with 7 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vocechat-web",
"version": "0.4.13",
"version": "0.4.14",
"homepage": "https://voce.chat",
"dependencies": {
"@electron-toolkit/preload": "^2.0.0",
+1 -2
View File
@@ -40,8 +40,7 @@ const Voice = () => {
useGetAgoraChannelsQuery(
{ page_no: 0, page_size: 100 },
{
skip: !enabled || !navigator.onLine,
pollingInterval: 10000
skip: !enabled || !navigator.onLine
}
);
const dispatch = useDispatch();
+5 -10
View File
@@ -134,17 +134,18 @@ export default function useStreaming() {
SSE.onopen = () => {
ready = false;
//todo
// opened = true;
// connectionIsOpen = true;
};
SSE.onerror = (err) => {
// 断网了
if (!navigator.onLine) {
stopStreaming();
}
const { readyState } = err.target as EventSource;
console.error("sse error", readyState, err);
// 连接还处于开启状态
if (readyState === EventSource.OPEN || readyState === EventSource.CONNECTING) {
return;
}
console.info("sse error", readyState, err);
// 重连
keepAlive(2000);
};
@@ -438,12 +439,6 @@ export default function useStreaming() {
if (streamingReady) {
startStreaming();
}
return () => {
if (streamingReady) {
console.info("debug SSE: stopStreaming at effect");
stopStreaming();
}
};
}, [streamingReady]);
return {