Push notifications from server to user with PHP/JavaScript

前端 未结 3 1964
一生所求
一生所求 2020-11-30 23:04

Short: Is there a way to push data from the server to a logged in user session without that user needing to make an HTTP request?

Long(er):<

相关标签:
3条回答
  • 2020-11-30 23:26

    ScaleDrone lets you push from PHP to JavaScript using a PHP API client.

    0 讨论(0)
  • 2020-11-30 23:38

    In modern browsers, Websockets or in older browsers, "long polling". There are also libraries that can abstract some of this (like comet).

    A very common library in use now is socket.io which automatically connects with the best technology available, using webSockets if available and falling back to other technologies like long polling if not available.

    Some other references:

    How do I implement basic "Long Polling"?

    COMET (server push to client) on iPhone

    More on Long Polling

    Is there a difference between long-polling and using Comet

    Pushing the web with websockets

    Oh HTML5, Push Data to my Mobile

    0 讨论(0)
  • 2020-11-30 23:44

    I recommend Socket.io

    It leverages

    WebSocket, FlashSocket, HTML file(for IE), XHR long-polling, JSONP-polling

    It is with Node.js which means it is on non-blocking nature.

    In realtime feature, concurrency is a big issue

    so the non-blocking nature of Node.js and Socket.io would help you

    0 讨论(0)
提交回复
热议问题