Comment

Comment by lvice

I've spent the last year working on an e-commerce project that esclusively uses websocket for real-time updates and communication. There are some great benefits to it, but websockets also introduce a lot of technical challenges that may not be obvious when you start. Things that come to mind are:

- Persistent connections make horizontal scaling more difficult

- Web Application Firewall don't usually support payload scanning for threats over websocket messages (eg. Cloudflare)

- If you need to integrate with third parties, you may end up needing a standard REST API anyway, since it's a lot less common to integrate via websockets (especially server-side). You then end up with two APIs. Also, websockets have less standard tooling for automatic documentation purposes such as Swagger/OpenAPI

- It's harder to load test the system, difficult to estimate the breaking point of the infrastructure via websockets

- HTTP Status Codes provide a standard error mechanism to HTTP server calls, while with websockets it's entirely up to you (which can be a good and bad thing)

- You need to manage explicitly situations where the connection drops and what to do when it recovers, as you may have lost some data in the meantime

- You give up a lot of standard mature tooling for caching and rate limiting

parent lvice 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton