I want to develop an applciation with Android Studio and have my server with TRtcHttpServer in a delphi application.
Now I've a problem with client requests.
I use TRtcDataProvider to handle http request and send data to android application when needed.
My problem is when I need from client a big data (readed from database on server) converted to JSON, this operation could be long about 30/40 seconds.
Now what is the best way to comunicate with client, now I do this:
in
OnCheckRequest1. check the header and url for client request
2.
myServer.Accept;
myServer.Response.ContentType := 'application/json';
myServer.Response.ContentLength := 0; <---- HERE IS MY FIRST PROBLEM: I don't know the [b]content-length[/b] becase the query is not executed
in
OnDataSent1. Execute needed database query
2. Convert the result as JSON
3. Write the data to client.
Is this the best way to do my work?