Skip to content

Implement Server Sent Events for generated clientsΒ #7435

Description

@zendern

Is your feature request related to a problem? Please describe the problem.

Related to:
#6885 and ultimately release 1.30.0 https://github.com/microsoft/kiota/releases/tag/v1.30.0 that mentions supporting OpenAPI Spec 3.2.0 which include support for SSE.


Request:
As an end user of kiota i would like for the clients to handle Server Sent Events (SSE). Fast API recently released support for it officially. https://github.com/fastapi/fastapi/releases/tag/0.135.0

My use case i want to be able to have a python fastapi backend sending SSE to both other python apps and typescript.


Example app using kiota 1.30.0
I have spun up a simple setup to help show a few things. https://github.com/zendern/sse-kiota-example

  1. the openapi spec doc that is being generated
  2. current behavior of kiota generated clients for both typescript/python

Client library/SDK language

None

Describe the solution you'd like

Python

httpx has support today to stream data back. https://www.python-httpx.org/quickstart/#streaming-responses.

Typescript

Unsure here. The native feature is to use EventSource https://developer.mozilla.org/en-US/docs/Web/API/EventSource. But since the default is to use fetch apis not sure how that looks. Its likely more complicated here since the result looks different than normal http traffic of request/response.


Ideally in both cases if the header from the openapi spec is text/event-stream it should use the language appropriate solution to make it work.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Needs Triage πŸ”

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions