高级前端
http
【Q387】http2 中 server push 与 websocket 有什么区别

http2 中 server push 与 websocket 有什么区别

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 392 (opens in a new tab)

Author 回答者: shfshanyue (opens in a new tab)

  • HTTP2 Server Push,一般用以服务器根据解析 index.html 同时推送 JPG/JS/CSS 等资源,而免了服务器发送多次请求
  • websocket,用以服务器与客户端手动编写代码去推送进行数据通信

Author 回答者: haotie1990 (opens in a new tab)

HTTP/2 服务器推送(Server Push)教程 (opens in a new tab)