×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    onComplete not called after search timeout

    Having looked through the HERE Web API documentation for nokia.places.search.manager, it states that the function onComplete is called when a request has completed and that a status of either "OK" or "ERROR" will be returned, the later indicating a failure or timeout.

    http://developer.here.com/docs/maps_...ger-findPlaces

    Running an example through a proxy with throttling (to ensure the search results take over 10 seconds), I see the error "Timeout - cannot connect to the server" being logged to the console but the callback onComplete is not being executed.

    I'm seeing this behaviour on Firefox 22.0 under Windows 7 64-bit.

  2. #2
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    Re: onComplete not called after search timeout

    As a rough workaround to this issue, I've wrapped the findPlaces function call with with another function that makes use of a timeout to determine if more that 10.5 seconds have elapsed without the success callback having been fired.

    HTML Code:
    // Allow 10.5 seconds for the Nokia results to return (Nokia times out after 10 seconds)
    var FIND_PLACES_TIMEOUT_MILLISECONDS = 10500;
    
    function findPlaces(searchTerm, onCompleteCallback) {
        'use strict';
    
        // Setup timeout to call the callback with timeout results after 10.5 seconds
        var nokiaFindPlacesTimeoutHandler = setTimeout(function () {
            onCompleteCallback(null, 'TIMEOUT');
        }, FIND_PLACES_TIMEOUT_MILLISECONDS);
    
        console.time('Time to retrieve search results from Nokia');
    
        nokia.places.search.manager.findPlaces({
            searchTerm: searchTerm,
            onComplete: function (nokiaSearchResponseView, status) {
    
                console.timeEnd('Time to retrieve search results from Nokia');
    
                // We successfully recieved the results so clear the timeout
                clearTimeout(nokiaFindPlacesTimeoutHandler);
    
                onCompleteCallback(nokiaSearchResponseView, status);
            }
        });
    }

Similar Threads

  1. Search -> Repeat search -> Post new thread
    By krzysztof.kucharewicz in forum Feedback on Forum Nokia's Renewal 2010
    Replies: 3
    Last Post: 2011-01-21, 11:00
  2. Replies: 3
    Last Post: 2009-06-01, 09:43
  3. Possible to do service search without device search?
    By ed_welch in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2008-02-11, 11:35
  4. Replies: 0
    Last Post: 2003-06-04, 19:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×