Custom socket node

In the past, ws has been a very unreliable connection it is true and you do indeed see lots of disconnections over time. It also has limitations around security, largely because you cannot use the standard web security mechanisms that require custom http headers (you only get that option for ws on the initial connection which happens over http, the connection then "upgrades" to ws).

In the past, enterprise firewalls would often block ws by default as well making the use of ws not universally useful.

That was why Socket.IO was made which helps to reduce some, not all, of those issues by providing auto-reconnect and fall-back to other schemes such as long-polling. Socket.IO also provides more abilities to create isolated communications channels. It doesn't solve all of the security issues though and if you need to manage timed sessions for security (and you should if you are intent on securing your application), you still need to pass the security token in every message as the custom header is not available.

Having said that, ws with auto-reconnection is a very effective communications channel between your front-end and back-end. Though in theory newer HTTP/2 and /3 capabilities may make it redundant eventually.

1 Like