Is there a real server push over http?

前端 未结 7 849
走了就别回头了
走了就别回头了 2020-12-05 08:06

I know there are ways to fake it, polling (or long polling) but is there any way to have the server contact the browser to push out information?

Either polling optio

7条回答
  •  时光取名叫无心
    2020-12-05 08:16

    I would think WebSockets (see http://en.m.wikipedia.org/wiki/WebSocket) is real push, so the answer would be: it depends upon the browser. If you need wide compatibility, the best you can do today is JavaScript libraries that will choose the best available protocol for the browser it's running in (e.g. https://github.com/ffdead/jquery-graceful-websocket). But you wanted server-friendly, and supporting multiple protocols is not server friendly. The current state-of-the-art is that doing cool stuff that works across browsers is engineering-intensive.

提交回复
热议问题