cpr icon indicating copy to clipboard operation
cpr copied to clipboard

Handling SSE

Open vymao opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?

Would be great if CPR could handle server sent events for streamed data. Currently I don't see mention of this in the documentation, and I'm trying to work around it by making WriteCallbacks, but this isn't optimal.

Possible Solution

A callback that instead could take in server sent events with error handling, instead of us having to parse it out manually and do a lot of string formatting with WriteCallbacks.

Alternatives

No response

Additional Context

No response

vymao avatar Jan 14 '24 01:01 vymao

As I understand it, a better "unbuffered" mode that invokes a callback for every event received is desired here?

COM8 avatar Jan 15 '24 18:01 COM8

Essentially yes, since right now, WriteCallbacks receive data in the form of a string, which isn't ideal to format if we are expecting JSON payloads.

vymao avatar Jan 15 '24 20:01 vymao

Right now this feature is not planed, but you are more than welcome to create PR for it.

COM8 avatar Jan 20 '24 18:01 COM8