Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

How to stream data in a serial mode? #557

Open
ababo opened this issue Jul 25, 2021 · 0 comments
Open

How to stream data in a serial mode? #557

ababo opened this issue Jul 25, 2021 · 0 comments

Comments

@ababo
Copy link

ababo commented Jul 25, 2021

When I create GCDWebServerStreamedResponse with asyncStreamBlock I end up with multiple threads simultaneously calling my handler. This is a bad scenario for me, since I want to process data and stream it sequentially (i.e. the order is important). This means I have to use NSLock or synchronise via single-threaded DispatchQueue which is far from an efficient implementation I would expect to achieve.

The ideal API would guarantee that my handler isn't called simultaneously in multiple threads. Alternatively I would like to use a synchronous streaming, when the request handler is called only once allowing me to call GCDWebServerBodyReaderCompletionBlock for multiple times, so I would call it in a loop while processing my data.

Can you clarify the way I should use GCDWebServer in my case?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant