What's the status of WebSocket protocol?

十年热恋 提交于 2019-12-08 09:08:36

问题


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

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

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

So are these headers definitions ready for use?

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


回答1:


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.

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.

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).



来源:https://stackoverflow.com/questions/28523914/whats-the-status-of-websocket-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!