Type Error: network error
I got Type Error: network error on my console. Whenever I refresh the browser.
This error come from line 913 https://github.com/Yaffle/EventSource/blob/64914d6f12f46e730e9ffd36dd1df1d28437de8b/src/eventsource.js#L913
I am not sure what cause this error. But I tried, commenting this line. The error then gone. Is there anyway to change this behaviour?
This error can be reproduce on Chrome and also on Firefox. If we can configure, how we handle this error, it would be nice. I suspect this error were thrown by the browser. We can't change how the browser behave, but we can at least decided how to handle this error.
Chrome Version 94.0.4606.81 event-source-polyfill: "1.0.25" Error: Type Error: network error SSE Server: Mercure Rocks v0.10.3
Firefox Version 91.0 event-source-polyfill: "1.0.25" Error: TypeError: Error in body stream SSE Server: Mercure Rocks v0.10.3
Also happens to me as well, do you have any workarounds?
Same here...any workarounds?
Nothing yet?
same issue here. network error occurs in readNextChunk method.
var readNextChunk = function readNextChunk() {
reader.read().then(function(result) {
if (result.done) {
//Note: bytes in textDecoder are ignored
resolve(undefined);
} else {
var chunk = textDecoder.decode(result.value, {
stream: true
});
onProgressCallback(chunk);
readNextChunk();
}
})["catch"](function(error) {
reject(error);
});
};
same issue here.
network erroroccurs inreadNextChunkmethod.var readNextChunk = function readNextChunk() { reader.read().then(function(result) { if (result.done) { //Note: bytes in textDecoder are ignored resolve(undefined); } else { var chunk = textDecoder.decode(result.value, { stream: true }); onProgressCallback(chunk); readNextChunk(); } })["catch"](function(error) { reject(error); }); };
I have found the problem after checking the server code. I configed a WriteTimeout option in server, it will auto close the connection after WriterTimeout. After unset this option, everything works fine. :smile:
@monstrum this error because http 1.x version cannot handle long live connections . So, you have 2 options
- Setup http2 handshake (mostly all browser's support) . But you may also need TLS instead of ssl . Http2 can handle long live connections.
- Simple, add
heartbeatTimeoutoption to less time while initializing eventsource
Happy coding :)