Closed blek-id closed 3 years ago
Hello, glad you liked the library!
I'm not entirely sure what causes that, never received error
event with empty message before.
But I did notice that sometimes the lib can stop receiving donations
event after a while (around 5-10mins too), maybe it has something to do with that.
Also make sure that your connection is stable.
I will try to investigate more.
i have same issue
can you create on error event?
it already has an on error
event, I am preventing the code to break by just listening on the event and logging the error
client.on("error", (error) => {
console.log(error);
});
this might help
Hi, just wanted to ask whether if you know what the
error
event listener actually is and how it works.It seems like they're being fired in a 5-10 minute delay with empty message in it
Event { type: 'error', message: undefined }
All emitted error
events are emitted (or redirected) from eventsource
This is what this lib does: https://github.com/SuspiciousLookingOwl/saweria-api/blob/master/src/Client.ts#L85:L90
this.eventSource.alert.addEventListener("error", (error) => {
this.emit("error", error);
});
this.eventSource.media.addEventListener("error", (error) => {
this.emit("error", error);
});
And this is what eventsource library does: https://github.com/EventSource/eventsource/blob/master/lib/eventsource.js#L53
function onConnectionClosed (message) {
if (readyState === EventSource.CLOSED) return
readyState = EventSource.CONNECTING
_emit('error', new Event('error', {message: message})) // this is probably the error event that you receive
...
}
Other error
events emitted from eventsource includes status
(e.g Event { type: 'error', message: "foo", status: 1}
)
So it's most likely that you had a connection issue and the library attempted to reconnect
Hi, just wanted to ask whether if you know what the
error
event listener actually is and how it works.It seems like they're being fired in a 5-10 minute delay with empty message in it
Event { type: 'error', message: undefined }
love your work, keep it up!