Yaffle / EventSource

a polyfill for http://www.w3.org/TR/eventsource/
MIT License
2.11k stars 336 forks source link

issue #151 heartbeatTimeout checks without delays #152

Closed jtempl closed 4 years ago

jtempl commented 4 years ago

this change provides for checking the heartbeat timout without any additional delays caused by fixed checking intervals. The basic idea is to not only store that there was some activity within the last heartbeatTimeout interval but to store also the timestamp of that activity. This timestamp can then be used to set a timer exactly to the remaining time span between the last activity and the expected heartbeat timeout.