Open junglie85 opened 7 years ago
Hopefully you're open to being asked questions in the issues?
Absolutely, sorry for being so late to answer.
The main idea for me too look at the issue would be to try to reproduce it without the Observable
.
What I'd like to try so far would be a simple :
sse.closeHandler { sseConnection ->
sseConnection?.close()
}
And I think it could reproduce the issue.
Simply because in these few lines of codes, it tries to close a connection that has already been closed by the client, hence the IllegalStateException
.
But I'd need to reproduce the issue, in Java, without any fancy Observable
involved. If you have time to do so, that'd be awesome, else I'll try to check by myself when I have the time.
For the lastId
stuff, same thing, I'd need to reproduce the issue in an unit test to give it a proper look.
lastId is null
because you have to pass it as header:
curl -v "http://localhost:8080/sse" -H "Last-Event-ID: 2"
it's the last id the client has received. If the client wants to reconnect to get the missing events, it has to reconnect with it. Otherwise, the client will get the current event and in this case, the lastEventId is null
.
Hopefully you're open to being asked questions in the issues? Really enjoying this library, but I'm trying to figure out how to gracefully deal with when the remote client disconnects, rather than the following exception:
I can't figure out from the tests how you're going about it. Perhaps I should use
EventSource
rather than just push data from the Observable directly? But that still seems like it would not affect the client connection.Anyway, this is my rather noddy test example (excuse Kotlin vice Java, but it should be reasonably clear what's going on):
As an aside (probably another question really), why does
connection.id(...)
send the details to the client? And why doeslastId()
return null?