开发者

implement a watcher in browser

开发者 https://www.devze.com 2023-01-29 18:12 出处:网络
I have a server on localhost 3000. I want to show the requests coming from a remote application to this server in a browser . How can 开发者_StackOverflow社区I achieve this ?Basic long polling soluti

I have a server on localhost 3000. I want to show the requests coming from a remote application

to this server in a browser . How can 开发者_StackOverflow社区I achieve this ?


Basic long polling solution:

  1. Record the requests from the remote app on your server (e.g. in a database)
  2. Poll with AJAX to fetch any new requests periodically.

Neat HTML5 websockets solution:

  1. Setup a websocket between your server and the browser.
  2. When a request is made, post message to the client over the websocket.

Maybe checkout http://pusherapp.com for more info on websockets.

0

精彩评论

暂无评论...
验证码 换一张
取 消