Skip to content

Releases: launchdarkly/okhttp-eventsource

4.1.1

27 Jun 19:13
Compare
Choose a tag to compare

[4.1.1] - 2023-06-27

Changed:

  • Bumping Guava version to incorporate CVE fixes.

4.1.0

10 Jan 01:46
Compare
Choose a tag to compare

[4.1.0] - 2023-01-09

This release is identical to 4.0.1. It exists for Semantic Versioning compliance: a new API was added (the StreamClosedWithIncompleteMessageException class) since 4.0.0, therefore the next version number should have been 4.1.0 rather than 4.0.1.

4.0.1

10 Jan 01:18
Compare
Choose a tag to compare

[4.0.1] - 2023-01-09

Added:

  • StreamClosedWithIncompleteMessageException (see below).

Fixed:

  • When using streaming data mode (see EventSource.Builder.streamEventData), if the stream connection was lost before the MessageEvent was fully read-- that is, before encountering a blank line-- the Reader returned by MessageEvent.getDataReader() was treating this as a regular EOF condition. That was incorrect; the SSE specification says that in such a case, the incomplete message is invalid and its contents should not be used. Therefore, in this case reading from the Reader will throw a StreamClosedWithIncompleteMessageException. The caller should handle this by simply throwing away the MessageEvent.

4.0.0

20 Dec 01:04
Compare
Choose a tag to compare

[4.0.0] - 2022-12-19

This release revises the implementation of EventSource so that it does not create its own worker threads. The methods for starting and reading a stream now perform synchronous I/O, and the caller is responsible for choosing what thread to start the stream and read the stream on. This makes the core implementation simpler and more efficient, and reduces possibilities for deadlock. If you want to continue using the old asynchronous push model, see the com.launchdarkly.eventsource.background package.

The configuration API has also been revised to separate out the HTTP functionality and the backoff/retry logic into subcomponents which can be customized or replaced.

Added:

  • EventSource methods readMessage(), readAnyEvents(), messages(), and anyEvents() for synchronously reading events.
  • EventSource.Builder(ConnectStrategy) constructor and the ConnectStrategy and HttpConnectStrategy classes, for customizing connection parameters.
  • EventSource.Builder(URI), (URL), and (HttpUrl) constructors, as shortcuts for minimal HTTP configuration.
  • EventSource.Builder.errorStrategy and the ErrorStrategy class, for customizing error recovery behavior.
  • EventSource.Builder.retryDelayStrategy and the RetryDelayStrategy and DefaultRetryDelayStrategy classes, for customizing or replacing backoff/jitter behavior.
  • StreamEvent, CommentEvent, StartedEvent, and FaultEvent classes, representing types of information other than MessageEvent that you can read synchronously from the stream.
  • The com.launchdarkly.eventsource.background package, containing the BackgroundEventSource wrapper for emulating the old push model.

Changed:

  • EventSource.Builder.restart is renamed to interrupt, to clarify that the restarting of the stream is not done immediately but only happens if you continue trying to read events after interrupt().
  • EventSource.Builder.backoffResetThreshold is renamed to retryDelayResetThreshold, to clarify that it applies to whatever kind of RetryDelayStrategy is being used even if that is not the default backoff strategy.
  • EventSource.Builder.reconnectTime is renamed to retryDelay, to clarify that it is describing a duration rather than a moment in time.
  • UnsuccessfulResponseException is renamed to StreamHttpErrorException, to clarify that it is specifically referring to an HTTP response with an error status.
  • The implementation of streamEventData mode is now simpler and no longer uses PipedInputStream and PipedOutputStream internally.

Removed:

  • ConnectionHandler and EventSource.Builder.connectionHandler(): replaced by ErrorStrategy.
  • EventHandler and the EventSource.Builder(URI, EventHandler) constructor: replaced by BackgroundEventHandler if you are using BackgroundEventSource.
  • EventSource.Builder methods connectTimeout, readTimeout, writeTimeout, method, body, headers, proxy, proxyAuthenticator, and requestTransformer: replaced by methods in HttpConnectStrategy.
  • EventSource.Builder.maxReconnect: replaced by DefaultRetryDelayStrategy.maxDelay.
  • EventSource.Builder.maxEventTasksInFlight: replaced by an equivalent option in BackgroundEventSource.

3.0.0

02 Dec 22:50
Compare
Choose a tag to compare

[3.0.0] - 2022-12-02

This release expands compatibility of the library with Android by removing Java 8 API usages that are not always available in Android. In effect, it restores the broader compatibility of the 1.x version while preserving the other API/functionality improvements that were added in 2.x. It also removes the previous dependency on SLF4J.

Changed:

  • Every EventSource and EventSource method that previously took a java.time.Duration parameter now takes (long, TimeUnit) parameters instead. This is to allow the library to be used from Android code on older platform versions that do not support the java.time types. It undoes an API change that was made in the 2.0.0 release.
  • SLF4J is no longer a dependency. Logging is done entirely through the com.launchdarkly.logging facade; see EventSource.Builder.logger.
  • Previously, if no logging destination was specified, the default behavior was to send log output to SLF4J. Now, the default behavior is to do no logging. If you still want to use SLF4J, do this (for "log.name", substitute whatever you want the logger name to be in SLF4J):
// import com.launchdarkly.logging.*;
// EventSource.Builder builder =
//   new EventSource.Builder(myHandler, streamUri);

builder.logger(
  LDLogger.withAdapter(LDSLF4J.adapter(), "log.name") 
);

Removed:

  • Logger interface, EventSource.Builder.logger(Logger), and EventSource.Builder.loggerBaseName. See note above on logging.

2.7.1

23 Aug 18:38
Compare
Choose a tag to compare

[2.7.1] - 2022-08-23

Changed:

  • Changed jitter logic that used java.util.Random to use java.security.SecureRandom. Even though in this case it is not being used for any cryptographic purpose, but only to produce a pseudo-random delay, static analysis tools may still report every use of java.util.Random as a security risk by default. The purpose of this change is simply to avoid such warnings; it has no practical effect on the behavior of the library.

1.11.3

23 Aug 03:47
Compare
Choose a tag to compare

[1.11.3] - 2022-08-22

Changed:

  • Changed jitter logic that used java.util.Random to use java.security.SecureRandom. Even though in this case it is not being used for any cryptographic purpose, but only to produce a pseudo-random delay, static analysis tools may still report every use of java.util.Random as a security risk by default. The purpose of this change is simply to avoid such warnings; it has no practical effect on the behavior of the library.

2.7.0

02 Aug 22:39
Compare
Choose a tag to compare

[2.7.0] - 2022-08-02

The main purpose of this release is to introduce a new logging facade, com.launchdarkly.logging, to streamline how logging works in LaunchDarkly Java and Android code. Previously, okhttp-eventsource used SLF4J for logging by default, but could be made to send output to a Logger interface of its own; the LaunchDarkly Java SDK used only SLF4J, so developers needed to provide an SLF4J configuration externally; and the LaunchDarkly Android SDK used Timber, but still brought in SLF4J as a transitive dependency of okhttp-eventsource. In this release, the default behavior is still to use SLF4J, but the logging facade can also be configured programmatically to do simple console logging without SLF4J, or to forward output to another framework such as java.util.logging, or other destinations. In a future major version release, the default behavior will be changed so that okhttp-eventsource does not require SLF4J as a dependency.

Added:

  • An overload of EventSource.Builder.logger() that takes a com.launchdarkly.logging.LDLogger instead of a com.launchdarkly.eventsource.Logger.

Deprecated:

  • The overload of EventSource.Builder.logger() that takes a com.launchdarkly.eventsource.Logger.
  • EventSource.Builder.loggerBaseName(): this method was only relevant to the default behavior of using SLF4J, providing a way to customize what the logger name would be for SLF4J. But when using the new framework, the logger name is built into the LDLogger instance. For example (having imported the com.launchdarkly.logging package): builder.logger(LDLogger.withAdapter(LDSLF4J.adapter(), "my.desired.logger.name"))

2.6.2

28 Jul 00:45
Compare
Choose a tag to compare

[2.6.2] - 2022-07-27

Changed:

  • Updated OkHttp dependency to v4.9.3 to get recent fixes, including a security fix.

2.6.1

29 Jun 20:34
Compare
Choose a tag to compare

[2.6.1] - 2022-06-29

Fixed:

  • The 2.5.0 and 2.6.0 releases mistakenly showed kotlin-stdlib as a compile-time dependency in pom.xml. While this library does use the Kotlin runtime (because the underlying OkHttp client uses Kotlin), that is a transitive dependency and is not needed at compile time.