javascript - Ajax request on PhoneGap faster on 2G then 3G -
while developing phonegap application ios , android found strange behavior. uploading file server faster via 2g 3g.
this difference 265 kb file:
2g: 0m 32s
3g: 7m 21s
of course did run speedtest (with speedtest.net app) on iphone:
2g: down: ~4 kb/s; up: ~2 kb/s
3g: down: ~280 kb/s; up: ~110 kb/s
this code in phonegap app:
// base64 encoded image of 265kb var base64img = "data:image/jpeg;base64,/9j/4aaqskzjrgabagaaaqa..."; $.ajax({ type: 'post', url: 'http://my.server.nl', data: {img: encodeuricomponent(base64img)}, datatype: "json", contenttype: "application/x-www-form-urlencoded;charset=utf-8" }).done(function(result){ console.log('done: ' + result); }).fail(function(result){ console.log('fail: ' + result); });
which genius can tell me why happening?
we solved problem uploading stuff via 'slow' 3g.
the problem different. used vodafone mobile operator, tried operator (*bliep) , working well. vodafone problem. found out vodafone modifying headers. changed connection: close
connection: keep-alive
.
now using ssl (https) connection, vodafone can't change headers. haven't had problems after changing ssl.
Comments
Post a Comment