瀏覽代碼

minor fixes

Olivier Massot 3 年之前
父節點
當前提交
41e7b03b9d
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 5 3
      services/sse/sseSource.ts
  2. 0 1
      store/sse.ts

+ 5 - 3
services/sse/sseSource.ts

@@ -38,12 +38,14 @@ class SseSource {
 
     this.eventSource = new EventSourcePolyfill(
       this.url.toString(),
-      { withCredentials: this.withCredentials }
+      {
+        withCredentials: this.withCredentials,
+        heartbeatTimeout: 45 * 1000 // in ms, timeout can not be disabled yet, so I set it very large instead
+      }
     );
 
     this.eventSource.onerror = (event) => {
-      console.error('SSE - An error happened : ' + JSON.stringify(event))
-      this.unsubscribe()
+      console.error('SSE - An error happened')
     }
     this.eventSource.onopen = () => {
       console.log('SSE - Listening for events...')

+ 0 - 1
store/sse.ts

@@ -1,6 +1,5 @@
 import {MercureEntityUpdate, sseState} from "~/types/interfaces";
 import {repositoryHelper} from "~/services/store/repository";
-import {models} from "~/models/_import";
 import ModelsUtils from "~/services/utils/modelsUtils";
 
 export const state = () => ({