How to push new HTML data from the server to the browser without refreshing the page

前端 未结 4 917
忘了有多久
忘了有多久 2021-01-03 02:54

I have seen many websites (facebook or stack overflow for instance) that will update certain features as new data is generated (new answer on a post for example).

L

相关标签:
4条回答
  • 2021-01-03 03:10

    Well,

    If you are in the PHP and Open Source world, you can consider Node.Js, Socket.IO or NowJs

    I am in the ASP.Net wonderworld and I love SignalR.

    0 讨论(0)
  • 2021-01-03 03:11

    You can use HTML5 SSE. But that's not a very good solution.

    You can use Comet server that helps in Long AJAX polling. Check out the Ajax Push Engine (APE). It's a combination of Comet Server and a Javascript framework to make AJAX-PUSH or real time streaming possible.

    cheers! :)

    0 讨论(0)
  • 2021-01-03 03:16

    One example of a framework that can help you do this is SignalR http://signalr.net/

    This is asp.net specific though

    0 讨论(0)
  • 2021-01-03 03:23

    Great question! There's a few solutions.

    There's been a relatively new solution to this call websockets. It's in the HTML5 standard and there's a lot of libraries for it on other languages too.

    One of them is sockets.io ( javascript ) - it enables you to keep a consistent, low-latency connection with a server to receive information as it's generated. There's also plenty of plugins for php, c, and python for the server side.

    To name a few: libwebsockets ( c++ ), pywebsockets ( python ), and jetty ( javascript )

    And for php: http://socketo.me/

    Visit this link for more info: http://www.html5rocks.com/en/tutorials/websockets/basics/

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