Question · JavaScript and React course · Module 10: React Ecosystem and Future

WebSocket vs REST

When is WebSocket a better choice than REST API in a React application?

Answer options

  • When the application has fewer than 100 users
  • When we need bidirectional real-time communication, e.g., chat, live notifications, stock data
  • Always - WebSocket is faster than REST in all scenarios
  • When we don't have access to a backend server

You can check the correct answer by solving this task in the CodeWorlds game.