Skip to content

Make the SSE stream an AutoCloseable Iterable bound to response close #35

Description

@OmarAlJarrah

Problem

The SSE surface is a bare Sequence, and the reader explicitly disclaims ownership of the response (ServerSentEventReader.kt:23). Partial consumption can strand the connection.

Proposed change

Expose SseStream : AutoCloseable, Iterable<ServerSentEvent> that closes the underlying response when the stream closes or is partially consumed (mirror the close-on-partial-consume invariant pagination enforces). Turn the current doc-warnings into enforced constrain-once / is-closed guards.

Acceptance

  • Closing the stream closes the response
  • Partial consumption doesn't leak
  • Tests + apiDump

Dependencies


Priority: medium · Effort: medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsdk-coresdk-core toolkit

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions