petelacey

petelacey

How to detect client's network quality

The Phoenix/LiveView-based product that my company makes has a very unusual usage profile. For months at a time, any particular customer will make very light usage of it. Until, suddenly, 20, 50, or even 100 or more users will start pounding on the product at once. This will last for 1-3 weeks before going silent again. This is expected and not a big deal.

However, the industry we serve is such that when these, say, 50+ people are hammering away, they are physically together in the same room as they do so! Furthermore, our customers are not tech savvy and so they tend to all be connected to the same under-powered office WiFi access point.

If this was a normal web application, then that wouldn’t be a problem. But with LiveView I now have 50+ people sitting inches away from each other and trying to keep a persistent websocket connection in place, all while uploading/downloading gigabytes of data per day. The result is calls to our support line saying the product is slow, when in reality they have an oversaturated access point and probably a great deal of EM interference.

What I’d like to do in this situation is simply notify users that their connection is wobbly and provide a link to instructions on how they can mitigate this. I experimented with JavaScript’s navigator.connection property (Chrome only, but that’s okay) and that might be enough. But it didn’t seem to notice when I enabled the liveview socket’s enableLatencySim, and I’m not sure if it should have.

In any event, I’m wondering if anyone else has dealt with this and what solutions you have come up with?

Thanks, Pete

Most Liked

arcanemachine

arcanemachine

This is a pretty hacky idea, but perhaps you could use Phoenix Presence to detect when a lot of users from the same organization or IP address are present at the same time, and just pre-emptively send a warning when a certain simultaneous user count is reached.

Obviously not the most practical idea, but if nothing comes up, it may be a workable (and easy-to-implement) solution.

rhcarvalho

rhcarvalho

Not a definitive answer, but:

  • Some tips here: Simulate Latency, Jitter, and Package Loss in Phoenix LiveView
  • I also recall a talk in which Chris McCord demos a LiveView showing live latency to clients around the world, but I couldn’t find it now.
  • Probably the best integration points would be global code in app.js monitoring client network performance, or a client Hook. In the absence of a better idea, you can measure pings between client and server and use that to trigger adding a CSS class/JS command to show the message about contacting IT, etc.

Where Next?

Popular in Questions Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

We're in Beta

About us Mission Statement