WebStream api and REST api, wh

what are the advantage of using websocket api to submit new trade etc over using rest api? does it have any speed advantages? I understand websocket api will get the “realtime” trade status update as event. With rest api we might have to keep query the endpoint to get updates, or mixed rest api with a websocket subscription to user account stream. What is the official recommended solution now.

Two main advantages of using the Websocket API over the REST API:

  • Reduced latency: No overhead of repeated HTTP requests and responses, leading to reduced latency and improved performance
  • Two-way communication: Allows both the client and server to send data to each other

It’s also just another option for those who prefer to use Websockets or who implement it for redundancy to have the REST API roll-over to the Websocket API or vice-versa should there be issues accessing one for whatever reason.