经常在工作当中需要测试手机 APP 的弱网环境,弱网的模拟可以使用 Fiddler 实现
if (m_SimulateModem) {
// Delay sends by 300ms per KB uploaded.
oSession["request-trickle-delay"] ="300";
// Delay receives by 150ms per KB downloaded.
oSession["response-trickle-delay"] ="150";
}
static function randInt(min, max) {
return Math.round(Math.random()*(max-min)+min);
}
if (m_SimulateModem) {
// Delay sends by 300ms per KB uploaded.
oSession["request-trickle-delay"] = ""+randInt(1,2000);
// Delay receives by 150ms per KB downloaded.
oSession["response-trickle-delay"] = ""+randInt(1,2000);
}