Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to suppress reconnection error? #194

Open
roman-sereda-lohika opened this issue Oct 4, 2021 · 12 comments
Open

How to suppress reconnection error? #194

roman-sereda-lohika opened this issue Oct 4, 2021 · 12 comments

Comments

@roman-sereda-lohika
Copy link

roman-sereda-lohika commented Oct 4, 2021

Error in my chrome console: Error: No activity within 45000 milliseconds. 11 chars received. Reconnecting.

I am fine that Event Source reconnects from time to time, but don't want to have errors in my console about it.

First of all why this is an error, not a warning?
Second is why do you use console.error instead of simply throwing errors?

The second part makes it pretty hard to catch this error, the only way i find to do this is overwriting console.error but it doesn't look like a proper solution, any other ways to suppress error?

@Yaffle
Copy link
Owner

Yaffle commented Oct 4, 2021

Can you prevent the error logging for narive EventSource?

@roman-sereda-lohika
Copy link
Author

Can you prevent the error logging for narive EventSource?

I am not familiar with native EventSource, but if here we have the same behaviour as in native then i see your point. Just wondering there should be a lot of people who should find this error irritating and how they deal with it

@roman-sereda-lohika
Copy link
Author

if i am not mistaken, in 1.0.15 package was just throwing error and it was working fine and i don't see any advantages in using console.error there

@Yaffle
Copy link
Owner

Yaffle commented Oct 5, 2021

@roman-sereda-lohika why was it working fine?
I think, before some version, the error was not thrown or reported for this case.
in other place of the code I was using setTimeout to throw an error, you cannot catch such errors with try-catch and the stack is lost sometimes

@Yaffle
Copy link
Owner

Yaffle commented Oct 5, 2021

if you want to ignore the errors, some mechanism is needed.
I can think of an 1) extra option or 2) event.preventDefault(); and checking if preventDefault was called in the code before calling console.error()
But it is hard to make a decision as this is not part of the native EventSource and I have not seen a lot someone doing this.

@roman-sereda-lohika
Copy link
Author

@Yaffle ahh, sorry for confusing, yeah, i see that it was not reported at all in previous versions, well, ok, i will just use some hacks around console.error, but if somebody else will argue about this i hope that some mechanism will be created, thanks

@monstrum
Copy link

I don't know, what you are using. In the Mercure Rocks, you can passed the Heart Beat Interval. Just set this lower than 45 Seconds, you should good to go. and if you can change the interval, then you can increase the interval in the event source options heartbeatTimeout.

@udhayakumarcp
Copy link

I am too facing the same error

@edarioq
Copy link

edarioq commented Jan 21, 2022

Solved it by

const eventSource = new EventSourcePolyfill('api/incoming', { heartbeatTimeout: 100000000 })

@olinox14
Copy link

It would be a useful feature to allow to disable the heartbeat. Mercure allows to do so in the hub config : https://mercure.rocks/docs/hub/config
So if you can disable it in the hub, being able to do the same client-side seems coherent.

@botjaeger
Copy link

solved it by adding this to my Mercure config heartbeat 15s

@onderilkesever
Copy link

It would be nice to have one of the two options you listed
##194 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants