Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. XMLHttpRequest troubles
Forum Updated to NodeBB v4.3 + New Features

XMLHttpRequest troubles

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rferrazz
    wrote on last edited by
    #1

    I'm having some troubles with the following code:
    @
    .pragma library

    var server_ip = "192.168.1.1"
    var server_port = "9876"

    function webdomo_get(path, callback){
    var http = new XMLHttpRequest();
    http.open("GET", "http://"+server_ip+":"+server_port+path, true);
    http.onreadystatechange = function(){
    if(http.readyState != http.DONE){
    return;
    }
    if(http.readyState == http.DONE && http.status == 200){
    var results = eval('('+http.responseText+')');
    callback(results);
    }
    }
    http.send();
    }@

    This request is fired by a timer every 3 sec.

    Here are my problems:

    1. Sometimes i notice the following error:
      QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply, 0 bytes on socket.
      and the timer that fires the request stops.

    2. I need a way to abort the request if the server doesn't respond

    3. Is possible that this code fires up two requests at the same time?

    Thanks

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giovannie
      wrote on last edited by
      #2

      https://bugreports.qt-project.org/browse/QTBUG-9315

      Request aborts itself after some time or you can use xmlhttprequest.abort().
      xmlhttprequest.timeout property doesn't work for me, it seems not implemented.

      Yes, it is possible.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved