search

Home  >  Q&A  >  body text

javascript - ajax long polling, what is the maximum number of pages that can be used?

The project requires real-time interactive viewing of customer order status.
The current page already has an ajax long polling, responsible for checking whether there are new orders.
Now there is a need to do one to see if there is new feedback... .
After I turned off polling, I found that it was no longer stuck.
Now I need to do two, will it crash directly?

The current long polling of the page is executed after the page is loaded, which makes the page seem to have been loaded forever.
It keeps turning on the title.
Do I need to add a setTimeout() to it?

伊谢尔伦伊谢尔伦2754 days ago467

reply all(5)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 13:00:29

    Since there is Ajax, change your method into an interface and get one or two or more results based on the passed parameters, so there is no need to initiate multiple requests

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:00:29

    The previously launched websocket protocol can meet your requirements and is also based on http.
    https://socket.io/ recommends you one.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 13:00:29

    考虑一下websocket

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 13:00:29

    html5 SSE (EventSource) server pushes to the client in real time, simpler than websocket

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:00:29

    It depends on how many seconds you request it

    reply
    0
  • Cancelreply