Replies: 2 comments
-
|
Yes — the Goa “mixed unary + SSE” pattern is to define both Something like: Method("create", func() {
Payload(JobCreatePayload)
Result(JobResult) // unary JSON
StreamingResult(JobProgress) // SSE events
HTTP(func() {
POST("/jobs")
ServerSentEvents()
Response(StatusOK)
})
})
This used to trigger a runtime panic / broken generated code in some cases; it’s fixed in PR #3883: #3883 (and the generated Go clients expose both unary and streaming variants for mixed-result methods). |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the reply. I tried this and I'm wondering on how to differentiate in the implementation. The generated signature is: where I'm seeing that the referenced PR is very recent. Is that already in a release, or should I wait until is being released? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How would I define a service endpoint POST /jobs which either waits until a job is done and returns the result or uses SSE to push progress events via SSE depending on the Accept header.
I did ask the friendly AI agent but didn't get an answer which would work ;)
Would this work?
Or would I need to use
SkipResponseBodyEncodeDecodeand build my own reply? Also, will that create the correct OpenAPI spec which would allow client side code generators to work that out?Beta Was this translation helpful? Give feedback.
All reactions