Yaffle / EventSource

a polyfill for http://www.w3.org/TR/eventsource/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internet Error After Closed.

cemalgnlts opened this issue · comments

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
}

Fixed. The problem was that I created multiple instances.