2 upvotes, 1 direct replies (showing 1)
View submission: Lets talk about those API calls
But isn't a machine limited to a certain amount of simultaneous open connections? One server, for example, could handle 30k websocket connections for 30k users but 500k rest API requests for 100k users. There's a reason rest APIs are popular. It's cheaper.
Comment by balta3 at 06/06/2023 at 20:54 UTC
2 upvotes, 0 direct replies
REST APIs are used for initial data transfers, websocket (or alternative long-running connections) are used for real-time notifications... There's a reason Google and Apple have Push-Services for their mobile ecosystems, this way the notifications can be transferred in real-time to the devices using one open connection to the device.
There is a limit for open connections because each connection needs it's own port, but this is not per server but per interface/IP. So give your server two IPs and you can double it easily.
So the rule is normally to use APIs (REST, GraphQL, ...) for loading data, use something like websockets or on mobile devices even better the push service of the ecosystem for notifications and messaging.