Reputation: 2804
I want to measure data usage (internet) and then show to the users which how much internet they have consumed.
My app is a chat application and the messages are text, image, sticker, video, post and shares, so users can open the image, see the text, watch the videos and scroll the posts.
Why I need this.
Because we have a poor internet connection in our country so I have to make sure the users that the app is not an internet killer.
Upvotes: 2
Views: 1146
Reputation: 51
If you're using a JS library for networking Axios
or even a builtin function (fetch) you can implement a wrapper Promise which calculates the length of any input/output string, + an approximation of the length of the header.
Upvotes: 2