DEV Community

Discussion on: Building a chat app with Socket.io and React πŸš€

 
joelbonetr profile image
JoelBonetR πŸ₯‡

Hahaha it depends on the case, here I found a good TL; DR on that 😁

Thread Thread
 
nevodavid profile image
Nevo David

Don't forget that in socket.io they also implemented long polling for old browsers :)

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡ • Edited

The way socket.io actually works is by assuming those are AJAX requests and once some communications had been exchanged it switches the protocol, thus it's not a protocol downgrade but an upgrade (you can check that in the network tab of chrome dev tools), also check the link in the last comment for more details. Is it convenient?

Well, web sockets has a good browser support so It depends on the use case of this "workaround" being more or less harmful.

Also note that socket.io has 4 different versions and both client and server need to implement the same version as far as I can remember, hence as soon as v5 appears you'll need to provide both v4 and v5 versions to avoid current clients software breaking and to provide latest stable version for new customers or customers that want to migrate (thinking on the use-case of providing just a backend as service).

Thread Thread
 
sorindezzy profile image
Raita Dezideriu

Wooow dude that’s so very Amazing 98% ? That says a lots mate

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡

Basically any browser version released in 2012 or newer (more or less) except from Opera Mini which I don't even know why they keep adding it to the metrics πŸ˜…

Thread Thread
 
nevodavid profile image
Nevo David

It's true and not true, it's like saying that compare to the population of the world, you child will be chinese, it's most likely not true :)
So while it's true that if you target the whole world with your app that might be the case.
But try to do the same for old enterprise companies, and I promise you, you will find some Windows XP :D

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡

πŸ˜‚πŸ˜‚
Well, that it's compatible with any browser version released in 2012 or newer is absolutely true. Some people around the world using older versions is a completely different topic 😁

I'd rather prefer the connection to be tested with the "newest" protocol and downgrade it if there's any incompatibility instead doing the opposite. It will add a delay to people with very very old devices and software and speed up the rest.

My logic is that people with very very old devices and software are already used to the slowness 😳I know it by experience, had a Pentium II with a 56Kb modem for more than 10 years, on those waiting times 100-200ms won't harm much, it's a little % overall πŸ˜