robbiehanson/CocoaHTTPServer — pull request #103 by zurbergram (2014-02-05 20:22:38+00:00)
Title: Changed HTTPConnection to include option for using a call back method to set httpResponse

Changed HTTPConnection
Added property useCallBack, default value of false
Added method useCallBack
Added method setUseCallBack:
Changed method httpResponseForMethod:URI:
Added method httpResponseForMethodStart:URI:
Added method httpResponseForMethodFinished:URI:

This change if useCallBack is set to true allows the server to wait to send the response until the app server would like the response sent. This allows for multithreaded work to be done from the app server before letting the client know the results.

Example:

A PC (client) ask the iOS device(app server) on same wifi network to start up a process and needs to know if the process was successful or not. The process on the app server requires the app server to make a call to another server(data server) to get data. When the app server makes a connection to the data server it creates another thread.

The original design would send the response before the app server's connection to the data server was finished doing it's work. The new design allows the app server to send a response based on what on interaction with the data server.