Yaffle / EventSource

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

Internet Error After Closed. #201

Closed cemalgnlts closed 2 years ago

cemalgnlts commented 2 years ago

Hi,

If I turn off my internet after using the close function, I get this error:

GET https://mercure.mail.tm/.well-known/mercure?topic=/accounts/123 net::ERR_INTERNET_DISCONNECTED
  at eventsource.js:553

TypeError: Failed to fetch
    at FetchTransport.open (eventsource.js:533:5)
    at onTimeout (eventsource.js:992:37)
    at eventsource.js:904:11

My close function.

const unlisten = () => {
  es.close();
  es.removeEventListener("message");
  console.log(es.readyState, es.CLOSED); // 2, 2
}
cemalgnlts commented 2 years ago

Fixed. The problem was that I created multiple instances.