Making two Json requests - is it OK?

Hi,

I need to make two json requests, i.e.

Comm.makeJsonRequest("api.openweathermap.org/.../weather",
{"lat"=>latLon[0].toFloat(), "lon"=>latLon[1].toFloat()}, {}, method(:onReceive));

Comm.makeJsonRequest("api.openweathermap.org/.../daily",
{"lat"=>latLon[0].toFloat(), "lon"=>latLon[1].toFloat(),"cnt"=>"5"}, {}, method(:onReceiveForecastDaily));

But I'm having trouble, the 1st one seems to get called and returns but the 2nd one doesn't. I'm still investigating why but just wondered if this is OK or if there's a better way?

Is it OK to call them one after the other? I did put the second call in the onReceive method of the 1st one but that didn't help.

Ta.
  • Former Member
    Former Member over 10 years ago
    It is okay to make more than one JSON request at the same time.

    If you make too many requests at the same time you should immediately get a response with the BLE_QUEUE_FULL error code.

    Right now the maximum number of concurrent JSON requests is set to 4.
  • The second call doesn't seem to happen, in that the onReceiveForecastDaily just doesnt get called

    Is there any way to help diagnose why!?

    Ta.

    [edit]

    not sure if it's related but in the CIQ_LOG.txt I have

    TVM ERROR:
    Circular Dependency Error
    Unfreed memory on exit

    I think there is a bug!

    I took the weather sample and added a 2nd json call like this :

    Comm.makeJsonRequest("api.openweathermap.org/.../weather",
    {"lat"=>latLon[0].toFloat(), "lon"=>latLon[1].toFloat()}, {}, method(:onReceive));

    Comm.makeJsonRequest("api.openweathermap.org/.../weather",
    {"lat"=>latLon[0].toFloat(), "lon"=>latLon[1].toFloat()}, {}, method(:onReceiveB));

    with a function

    function onReceiveB(responseCode, data)
    {
    Sys.println("in onReceiveB");
    }

    the onReceive function is called but the onReceiveB never is!!!!

    HELP!

    ARRRRRRGGGGG!

    Now neither of the functions are being called!!!! Rebooted watch and phone still no good. What is going on!?

    I THINK OPEN WEATHER API MIGHT BETHE CULPRIT - ITS NOT RETURNING ANYTHING!

    Damn, just switch to wundergorund weathr and that isn't firing the callback functions! Works on the simulator. Whats going on!?!?