Android Question HttpUtils2 - HttpJob question

Massimiliano

Member
Licensed User
Longtime User
Hello,
I have a simple HttpJob posting queries via Http and receiving some Json data.
This is a little example

B4X:
Sub GetData(MyURL As String, MyPOST As String)
    Dim job As HttpJob
    job.Initialize("Job", Me)
    job.PostString(MyURL, MyPOST)
End Sub

Sub JobDone(Job As HttpJob)
    'Some Operations
End Sub

My question is:
If a query (n+1) come after a query (n), and query (n) is still executing will be aborted or will be 2 "JobDone" Calls?

I would like only to have the last query returned. So, if query (n) is already running and query (n+1) is asked via http, (n) should be aborted (I'm not interested anymore) and i'll need to wait only for (n+1)...... and so for (n+2).....
Thank you

Massimiliano
 

DonManfred

Expert
Licensed User
Longtime User
I´m not sure i understand the question.
BUT: Each call to GetData will result in starting a new download which then will raise a call to JobDone.
In short: Calling GetData twice will result in two Jobdone raises...

But they are not supposed to be in order. Maybe the second is faster then the first then the second will raise the first Jobdone
 
Upvote 0

Massimiliano

Member
Licensed User
Longtime User
@DonManfred
...But they are not supposed to be in order!!! as you say

I must to be sure to have only the latest query, so i need to abort previsious running queries

Any hint?
Many thanks
 
Upvote 0

Massimiliano

Member
Licensed User
Longtime User
:)

My json data follow a changing my location marker over a gmap, so I need these almost in realtime.
Only the latest query is the most important
 
Upvote 0

Massimiliano

Member
Licensed User
Longtime User
A simple solution i've found is to send a request id to the server, so the server replies with this id.
So i can get the right and latest response id, but i do not like to take thia approach ... could open too much connections to the server
 
Upvote 0

Massimiliano

Member
Licensed User
Longtime User
Since to know who was the latest client to make a request to the server i'll need to store some data inside the server session (ip for example), this is a bad solution for me.
I dont' want to save any client data to the server.
First, I would like to respect privacy, even for ip addresses.
 
Upvote 0
Top