I am working on eventSource where I get percentage from backend. To implement that I have used Event source pollyfill
My problem is backend is taking some time(2 to 3 mins) to respond. But at the front end the eventSource API is failing stating -
No activity within 45000 milliseconds. Reconnecting
To fix that I tried this solution. But no matter what changes I make in eventSource.js in node_modules they are not reflecting.
Can somebody please look.
Thanks in advance!
Set options.hearbeatTimeout to a very large number.
E.g. 10 * 60 * 1000 would make it 10 minutes. (The 45000 is just the default.)
To show it is possible, I found an example for doing that in Vue here: https://github.com/tserkov/vue-sse/issues/35#issuecomment-986807802
BTW, there should be no need to hack the source, when an option is already supplied. I've had mixed luck modifying the files in node_modules - they risk getting replaced without notice. Better is to make a branch on github, modify it there, and change your entry in package.json to link to that:
"the_package": "github:YourName/the_package#master",