Releases: launchdarkly/okhttp-eventsource
Releases · launchdarkly/okhttp-eventsource
2.6.0
[2.6.0] - 2022-06-28
Added:
EventSource.Builder.streamEventData
andEventSource.Builder.expectFields
, for enabling a new event parsing mode in which event data can be consumed directly from the stream without holding it all in memory. This may be useful in applications where individual events are extremely large.MessageEvent.getDataReader
andMessageEvent.isStreamingData
, for use with the new mode described above.MessageEvent.getEventName
, providing access to the event name from the event object; previously the event name was only available as a parameter ofEventHandler.onMessage
.
Changed:
- Miscellaneous improvements in memory usage and performance when parsing the stream, even in the default mode.
2.5.0
[2.5.0] - 2022-01-13
Added:
EventSource.Builder.maxTasksInFlight
allows setting a limit on how many asynchronous event handler calls can be queued for dispatch at any given time. (Thanks, thomaslee!)EventSource.awaitClosed
provides confirmation that all asynchronous event handler calls have been completed after stopping theEventSource
. (Thanks, thomaslee!)
Changed:
- The build has been updated to use Gradle 7.
- The CI build now includes testing in Java 17.
2.4.0
[2.4.0] - 2022-01-06
This release fixes a number of SSE spec compliance issues which do not affect usage in the LaunchDarkly Java and Android SDKs, but could be relevant in other use cases.
Added:
EventSource.Builder.readBufferSize
Changed:
- The implementation of stream parsing has been changed. Previously, we were using
BufferedSource
from theokio
library, but that API did not support\r
line terminators (see below). Now we use our own implementation, which is simpler thanBufferedSource
and is optimized for reading text lines in UTF-8. - The CI build now incorporates the cross-platform contract tests defined in https://github.com/launchdarkly/sse-contract-tests to ensure consistent test coverage across different LaunchDarkly SSE implementations.
Fixed:
- The stream parser did not support a
\r
character by itself as a line terminator. The SSE specification requires that\r
,\n
, and\r\n
are all valid. - If an event's
id:
field contains a null character, the whole field should be ignored. - The parser was incorrectly trimming spaces from lines that did not contain a colon, so for instance
data[space]
was being treated as an emptydata
field, when it is really an invalid field name that should be ignored.
2.3.2
[2.3.2] - 2021-06-24
Fixed:
- Fixed a bug that caused the connection error handler to be called twice instead of once, with only the second return value being used. The second call would always pass an
EOFException
instead of the original error. The result was that any connection error handler logic that needed to distinguish between different kinds of errors would not work as intended.
1.11.2
[1.11.2] - 2020-09-28
Fixed:
- Restored compatibility with Java 7. CI builds now verify that the library can be compiled and tested in Java 7 rather than just building with a target JVM setting of 1.7.
- Bumped OkHttp version to 3.12.12 to avoid a crash on Java 8u252.
- Explicitly closing the stream could also cause an unnecessary backoff delay (with a log line about waiting X amount of time) before the stream task actually shut down.
2.3.1
[2.3.1] - 2020-06-18
Fixed:
- Worker threads might not be shut down after closing the EventSource, if the stream had previously been stopped due to a ConnectionErrorHandler returning
SHUTDOWN
. Now, the threads are stopped as soon as the stream is shut down for any reason. (#51) - Fixed a race condition that could cause
onClosed()
not to be called in some circumstances where it should be called.
2.3.0
[2.3.0] - 2020-06-02
Added:
EventSource.Builder.logger()
and theLogger
interface allow a custom logging implementation to be used instead of SLF4J.EventSource.Builder.loggerBaseName()
allows customization of the logger name when using the default SLF4J implementation.- Greatly improved unit test coverage; the CI build will now enforce coverage goals (see
CONTRIBUTING.md
).
Fixed:
- Explicitly closing the stream could cause a misleading log line saying that the connection error handler had shut it down.
- Explicitly closing the stream could also cause an unnecessary backoff delay (with a log line about waiting X amount of time) before the stream task actually shut down.
- Fixed a bug that could cause the randomized jitter not to be applied to reconnection delays if the reconnect interval (in milliseconds) was a power of two.
1.11.1
[1.11.1] - 2020-05-26
Fixed:
- Fixed a bug that could cause the randomized jitter not to be applied to reconnection delays if the reconnect interval (in milliseconds) was a power of two.
2.2.0
[2.2.0] - 2020-05-08
Added:
EventSource.Builder.threadPriority()
specifies thatEventSource
should create its worker threads with a specific priority.
2.1.0
[2.1.0] - 2020-04-29
Added:
EventSource
methodrestart()
(also added in 1.11.0).
Changed:
- Updated OkHttp version to 4.5.0.