소스 검색

minor fixes

Olivier Massot 3 년 전
부모
커밋
1f94f00b85
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 = () => ({