Explain why CDN (in)availability may be a problem for using WebSockets?

Technology CommunityCategory: WebSocketsExplain why CDN (in)availability may be a problem for using WebSockets?
VietMX Staff asked 3 years ago

Today (almost 4 years later), web scaling involves using Content Delivery Network (CDN) front ends, not only for static content (html,css,js) but also your (JSON) application data.

Of course, you won’t put all your data on your CDN cache, but in practice, a lot of common content won’t change often. I suspect that 80% of your REST resources may be cached… Even a one minute (or 30 seconds) CDN expiration timeout may be enough to give your central server a new live, and enhance the application responsiveness a lot, since CDN can be geographically tuned…

To my knowledge, there is no WebSockets support in CDN yet, and I suspect it would never be. WebSockets are statefull, whereas HTTP is stateless, so is much easily cached. In fact, to make WebSockets CDN-friendly, you may need to switch to a stateless RESTful approach… which would not be WebSockets any more.