Class SseStream

java.lang.Object
com.alibaba.dashscope.transport.sse.SseStream
All Implemented Interfaces:
AutoCloseable, Iterable<com.fasterxml.jackson.databind.JsonNode>

public final class SseStream extends Object implements AutoCloseable, Iterable<com.fasterxml.jackson.databind.JsonNode>
Blocking, pull-model SSE parser (design §6). Single-use: yields each data: frame as a parsed JsonNode; [DONE] or EOF ends the stream. No background threads — the caller's thread drives reads. Frame syntax: data lines join with \n, blank line dispatches, event:/id:/retry: and comment lines are ignored.
  • Constructor Details

    • SseStream

      public SseStream(okhttp3.Response response)
    • SseStream

      public SseStream(okhttp3.Response response, EncryptionConfig encryptionConfig)
  • Method Details

    • responseHeaders

      public okhttp3.Headers responseHeaders()
      Response headers of the opening HTTP exchange (request id lookup etc.).
    • headersMap

      public Map<String,String> headersMap()
      Snapshot of responseHeaders() as a plain map (response envelope filling etc.).
    • iterator

      public Iterator<com.fasterxml.jackson.databind.JsonNode> iterator()
      Specified by:
      iterator in interface Iterable<com.fasterxml.jackson.databind.JsonNode>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable