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?
When I create
GCDWebServerStreamedResponse
withasyncStreamBlock
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 useNSLock
or synchronise via single-threadedDispatchQueue
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?