Improve SSE implementation · Issue #839 · a2aproject/a2a-java · GitHub
Skip to content

Improve SSE implementation #839

Closed

Description

@kabir

A review on #820 showed that our SSE implementation might be too naive:

The current SSE implementation incorrectly dispatches each line starting with data: as a separate message. According to the SSE specification, multiple data: lines should be buffered and concatenated (with newlines) until an empty line is encountered, at which point the complete event should be dispatched. This will cause JSON parsing failures for any multi-line payloads.

Image

Activity

  1. added this to the 1.0.0 milestone on Apr 29, 2026
  2. jmesnil commented on Apr 29, 2026

    @jmesnil
    Contributor

    FWIW https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format to correctly implement the SSE format.

    It could be interesting to also add event to our stream (eg: event: <message|task| statusUpdate|artifactUpdate)

  3. ehsavoie commented on Apr 29, 2026

    @ehsavoie
    Collaborator

    We could try to reuse the implementation I wrote for vertx

  4. self-assigned this
    on Apr 30, 2026
  5. ehsavoie commented on Apr 30, 2026

    @ehsavoie
    Collaborator

    @jmesnil does that means that we wouldn't rely on the data events only anymore ?

  6. jmesnil commented on Apr 30, 2026

    @jmesnil
    Contributor

    @ehsavoie no, the idea was to identify the data with an event something like:

    event: statusUpdate
    data: {"statusUpdate": {"taskId": "task-uuid", "status": {"state": "TASK_STATE_COMPLETED"}}}
    

    but this is silly, the type of events is already clear from the data.

  7. ehsavoie commented on Apr 30, 2026

    @ehsavoie
    Collaborator

    Well it could 'help' if you want to subscribe to only a single source/type of event but then you would need to register to every type

  8. added 3 commits that reference this issue on May 6, 2026
    14a480f
    bc9e6e7
    c1c1b89
  9. added a commit that references this issue on May 12, 2026
    6787c23
  10. added a commit that references this issue on May 12, 2026
    e693005
  11. added a commit that references this issue on May 12, 2026
    c98e7cd
  12. added a commit that references this issue on Jun 19, 2026
    37e7105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions