WebSocket协议的状态是什么? [英] What's the status of WebSocket protocol?

查看:563
本文介绍了WebSocket协议的状态是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IANA注意事项的部分https://tools.ietf.org/html/rfc6455\"rel =nofollow> RFC 6455 - Web套接字协议。

I see a section called IANA Considerations in the RFC 6455 - Web Socket Protocol.

它定义了几个HTTP要添加到HTTP协议的标头。例如 Sec-WebSocket-Key Sec-WebSocket-Extensions 等。

It defines several HTTP headers to be added to HTTP protocol. Such as Sec-WebSocket-Key, Sec-WebSocket-Extensions, etc.

但我没有在 RFC 2616 - HTTP 1.1协议中找到这些标题。

But I didn't find these headers in the RFC 2616 - HTTP 1.1 Protocol.

这些标题定义是否可供使用?

So are these headers definitions ready for use?

(我不太熟悉RFC文档的组织方式所以请原谅我这是一个愚蠢的问题。)

(I am not quite familiar with how RFC documents are organized. So pardon me this is a dumb question.)

推荐答案

HTTP协议允许将自定义标头添加到任何HTTP请求中。如果HTTP服务器不知道特定的头名称,它只是忽略它。 webSocket连接的启动会为其HTTP请求添加一些自定义标头,这些标头不是标准的HTTP定义标头名称,但它们被格式化为标准HTTP标头(如RFC 2616第4.2节中所定义),因此可以被任何HTTP安全地忽略不理解它们的服务器。

The HTTP protocol allows for custom headers to be added to any HTTP request. If the HTTP server doesn't know about a particular header name, it just ignores it. The initiation of a webSocket connection adds some custom headers to its HTTP request that are not standard HTTP-defined header names, but they are formatted as standard HTTP headers (as defined in section 4.2 of RFC 2616) and thus are safely ignored by any HTTP server that doesn't understand them.

正如Julian在评论中指出的,你可以看到注册的Sec-WebSocket-xxx标题在IANA标头注册表中,您可能已经看过,这些标题的含义在更多内容中有所描述详细信息请参见 RFC 6455

As Julian pointed out in comments, you can see the Sec-WebSocket-xxx headers registered here in the IANA header registry and you may have already seen, the meaning of those headers are described in more detail in RFC 6455.

此外, RFC 7231第8.3节描述了定义和注册新标题及其应遵循的规则(以及其他有助于def的规范)那些规则)。

Furthermore, section 8.3 of RFC 7231 describes the general process for defining and registering new headers and the rules that they should follow (and other specifications that help define those rules).

这篇关于WebSocket协议的状态是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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