[SailfishDevel] browser versus ajax
Kim Foder
kim at foder.dk
Sat Jun 25 18:41:26 UTC 2016
> Both captures have 200 response
Yes that much I can understand.
If you look at this picture (from wireshark), you will see that the first request is successful,
but the second one behaves differently.
Even though it returns a status 200, something is wrong as shown in line 14 & 15.
I'm using the following code to do both requests:
function execCommand(command)
{
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
console.log('ReadyState: ' + xhr.readyState);
if(xhr.readyState == 4)
{
console.log('Status: ' + xhr.status);
if (xhr.status == 200){
var fv = xhr.responseText;
console.log('Result: ' + fv);
}}
}
var c = "http://10.5.5.9:8080/" + command;
console.log(c);
xhr.open('GET',c);
xhr.send();
}
And the following to execute the request (in a button onclick event):
execCommand("gp/gpControl/status");
The output for the failing request is:
execCommand: 89 - http//10.5.5.9:8080/gp/gpControl/status
:77 - ReadyState: 1
and after a very long time (at least it feels that way):
:77 - ReadyState: 4
:80 - Status: 0
/Kim
On fredag den 24. juni 2016 13.49.42 CEST Kimmo Lindholm wrote:
> And how it looks with your app?
> Both captures have 200 response
>
> Can show your code too?
>
> -kimmo
>
> -----Original Message-----
> From: devel-bounces at lists.sailfishos.org
> [mailto:devel-bounces at lists.sailfishos.org] On Behalf Of Kim Foder Sent:
> 23. kesäkuuta 2016 23:33
> To: devel at lists.sailfishos.org
> Subject: [SailfishDevel] browser versus ajax
>
> Hi
>
> I'm trying to make a gopro Hero4 app for Sailfish, but have hit a wall :(
>
> When I send a request to the Hero (for example a status request http://
> 10.5.5.9:8080/gp/gpControl/status) in the address line of a browser (laptop
> or Jolla) I get the expected response, but when I try via ajax from qml I
> get no response (ready state 1 and after a long time ready state 4).
>
> I have captured the IP traffic (in pcap format), but do not have enough
> knowledge to interpret the results.
>
> If anyone here do have the knowledge to help me, I'll be gratefull.
>
> The captured sessions can be downloaded here:
> http://kimfoder.dk/capture.zip.
>
> /Kim
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20160625/9a96bd9e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image
Type: image/png
Size: 120551 bytes
Desc: not available
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20160625/9a96bd9e/attachment-0001.png>
More information about the Devel
mailing list