Open kdzwinel opened 8 years ago
Won't that only emulate high latency? Throttling is rather for restricting bandwidth, I believe.
@MichielDeMey thanks for input! You are right - setTimeout will only emulate latency. I'm not sure how to correctly emulate bandwidth at this point, but I'd guess that it should be throttled somewhere around here (traffic-interceptor.js):
res.write = function(chunk) {
_write.apply(res, arguments);
We can split each received data chunk into multiple smaller ones.
http://thesmithfam.org/blog/2012/04/11/throttling-your-network-connection-on-mac-os-x/
maybe we can actually do it :)
Note: to show the network throttling panel back again revert https://github.com/kdzwinel/betwixt/commit/c002175d9e1f32ff5c528a1af06a8c3cb665509e .
You can use something like https://github.com/tjgq/node-stream-throttle (which uses https://github.com/jhurliman/node-rate-limiter) to throttle a stream.
IMO doing a simple
setTimeout
on the proxy server should work just fine for most cases.