Does the front and back end of non-instant messaging app, use http interaction or socket??

socket, put the request in the redis queue, even if the background hangs, it can be executed after the service reply, but some daily requests that are asynchronous will pile up in the queue. In http"s words, Synchronize returns success and failure. Which one should I use to describe the ~-sharp-sharp-sharp problem

Feb.14,2022

look at the usage scenario. If you use socket , you can actively notify app when there is a data update at the backend. Using http requires regular polling of backend APIs but is easy to use.

non-instant messaging app is still recommended to use socket to get user messages. Reason:

  1. avoid heavy query pressure caused by frequent requests. http request method will exert greater pressure on DB when concurrent queries. socket can take turns to process messages, and the initiative is at the backend
  2. .
  3. when the network is poor, socket is easier to use than http . In the case of poor network, http three-way handshake is very slow. Carelessness will cause requests to pile up
  4. .
  5. it is very convenient to count the number of people online
Menu