Sobes.tech
Senior

If we need to update a financial schedule in real-time, what would you choose for data retrieval? Explain the pros and cons of polling and WebSockets.

sobes.tech AI

Answer from AI

To update a real-time financial chart, the choice between polling and WebSockets depends on latency and load requirements.

Polling — the client periodically sends requests to the server to get new data.

  • Pros: simple implementation, works through standard HTTP requests, does not require a persistent connection.
  • Cons: delay between updates depends on the polling interval, excessive traffic with frequent polling, server load.

WebSockets — a persistent bidirectional connection is established between the client and server.

  • Pros: instant data delivery, efficient resource usage, suitable for frequent updates.
  • Cons: more complex to implement and scale, requires support on server and client, potential issues with proxies and firewalls.

For a financial chart with high requirements for timeliness and update frequency, WebSockets are preferable. If updates are not time-critical or infrastructure is limited, polling with an optimal interval can be considered.

If we need to update a financial schedule in… - sobes.tech