HTTP/2是否会使websocket过时? [英] Does HTTP/2 make websockets obsolete?

查看:254
本文介绍了HTTP/2是否会使websocket过时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习HTTP/2协议.这是带有小消息帧的二进制协议.它允许通过单个TCP连接进行流多路复用.从概念上讲,它似乎与WebSockets非常相似.

I'm learning about HTTP/2 protocol. It's a binary protocol with small message frames. It allows stream multiplexing over single TCP connection. Conceptually it seems very similar to WebSockets.

是否有计划废弃Websocket,并用某种无头HTTP/2请求和服务器启动的推送消息替换它们?还是WebSockets可以补充HTTP/2?

Are there plans to obsolete websockets and replace them with some kind of headerless HTTP/2 requests and server-initiated push messages? Or will WebSockets complement HTTP/2?

推荐答案

据我了解,HTTP/2并不是websocket的替代品,而是旨在标准化SPDY协议.

From what I understood HTTP/2 is not a replacement for websocket but aims to standardize SPDY protocol.

在HTTP/2中,幕后使用server-push来改善客户端从浏览器加载的资源.作为开发人员,您在开发过程中并不十分在意.但是,使用Websocket,允许开发人员使用API​​,该API能够通过唯一的全双工连接来使用和推送消息.

In HTTP/2, server-push is used behind the scene to improve resource loading by the client from the browser. As a developer, you don't really care about it during your development. However, with Websocket, the developer is allowed to use API which is able to consume and push message with an unique full-duplex connection.

这些不是相同的东西,它们应该相互补充.

These are not the same things, and they should complement each other.

这篇关于HTTP/2是否会使websocket过时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆