add-fetch-eventsource-close-on-error
This commit is contained in:
parent
8ce300bacb
commit
5d749c09a7
|
@ -46,11 +46,12 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
console.log(message)
|
console.log(message)
|
||||||
},
|
},
|
||||||
onclose() {
|
onclose() {
|
||||||
// if the server closes the connection unexpectedly, retry:
|
// if no error thrown - it will reconnect
|
||||||
console.log("sse connection closed")
|
console.log("sse connection closed")
|
||||||
},
|
},
|
||||||
onerror(err) {
|
onerror(err) {
|
||||||
console.warn(err)
|
console.warn(err)
|
||||||
|
throw new Error() // hack to close the connection
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user