add-fetch-eventsource-close-on-error

This commit is contained in:
Untone 2023-10-11 17:41:36 +03:00
parent 8ce300bacb
commit 5d749c09a7

View File

@ -46,11 +46,12 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
console.log(message)
},
onclose() {
// if the server closes the connection unexpectedly, retry:
// if no error thrown - it will reconnect
console.log("sse connection closed")
},
onerror(err) {
console.warn(err)
throw new Error() // hack to close the connection
}
})