Package com.launchdarkly.eventsource
Class ConnectStrategy.Client.Result
java.lang.Object
com.launchdarkly.eventsource.ConnectStrategy.Client.Result
- Enclosing class:
- ConnectStrategy.Client
The return type of
ConnectStrategy.Client.connect(String).-
Constructor Summary
ConstructorsConstructorDescriptionResult(InputStream inputStream, URI origin, Closeable closer) Creates an instance.Result(InputStream inputStream, URI origin, Closeable closer, ResponseHeaders headers) Creates an instance with response headers. -
Method Summary
Modifier and TypeMethodDescriptionAn object thatEventSourcecan use to close the connection.Returns the response headers from the connection, or null if not available.The input stream thatEventSourceshould read from.The origin URI that should be included in everyMessageEvent.
-
Constructor Details
-
Result
Creates an instance.- Parameters:
inputStream- seegetInputStream()origin- seegetOrigin()closer- seegetCloser()
-
Result
Creates an instance with response headers.- Parameters:
inputStream- seegetInputStream()origin- seegetOrigin()closer- seegetCloser()headers- seegetHeaders()- Since:
- 4.2.0
-
-
Method Details
-
getInputStream
The input stream thatEventSourceshould read from.- Returns:
- the input stream (must not be null)
-
getOrigin
The origin URI that should be included in everyMessageEvent.The SSE specification dictates that every message should have an origin property representing the stream it came from. In the default HTTP implementation, this is simply the stream URI; other implementations of
ConnectStrategycan set it to whatever they want.If this value is null, it defaults to the original URI that was returned by
ConnectStrategy.Client.getOrigin()prior to making the connection attempt. This allows clients to modify the origin if necessary for each attempt, for instance, if using different query parameters.- Returns:
- the stream URI
-
getCloser
An object thatEventSourcecan use to close the connection. If this is not null, itsCloseable.close()method will be called whenever the current connection is stopped either due to an error or because the caller explicitly closed the stream.- Returns:
- a Closeable object or null
-
getHeaders
Returns the response headers from the connection, or null if not available.For HTTP connections, this contains the HTTP response headers. For other connection types, this may be null or may contain connection-specific metadata.
- Returns:
- the response headers, or null if not available
- Since:
- 4.2.0
-