RFC6455-The WebSocket protocol 之三:WebSocket URIs

3.WebSocket URIs


This specification defines two URI schemes, using the ABNF syntax
defined in RFC 5234 [RFC5234], and terminology and ABNF productions
defined by the URI specification RFC 3986 [RFC3986].

本说明书定义了两种格式的URI,一种是[RFC5234]定义的ABNF ,一种是 [RFC3986]中定义的术语和ABNF。


ws-URI = "ws:" "//" host [ ":" port ] path [ "?" query ]
wss-URI = "wss:" "//" host [ ":" port ] path [ "?" query ]

// 对上面格式的说明
host = <host, defined in [RFC3986], Section 3.2.2>
port = <port, defined in [RFC3986], Section 3.2.3>
path = <path-abempty, defined in [RFC3986], Section 3.3>
query = <query, defined in [RFC3986], Section 3.4>


The port component is OPTIONAL; the default for "ws" is port 80,
while the default for "wss" is port 443.

端口选项是可选的;“ws”的默认端口是80,“wss”的默认端口是443.


The URI is called "secure" (and it is said that "the secure flag is
set") if the scheme component matches "wss" case-insensitively.

假如URI与“wss”匹配(不区分大小写),该URI就被称之为“安全的”(并且被称之为“安全标记已经设置”)


The "resource-name" (also known as /resource name/ in Section 4.1)
can be constructed by concatenating the following:
o "/" if the path component is empty
o the path component
o "?" if the query component is non-empty
o the query component

“资源名”(同4.1节中的/资源名/)由以下部分组成:

  • "/" 当路径为空的情况使用。
  • 路径。
  • "?" 当查询参数不为空使用。
  • 查询参数。


Fragment identifiers are meaningless in the context of WebSocket URIs
and MUST NOT be used on these URIs. As with any URI scheme, the
character "#", when not indicating the start of a fragment, MUST be
escaped as %23.

在websocket的URI中,片段标识符是没有含义的而且不应该被使用。就像其它URI一样,当“#”不代表片段的开始时,必须转换成“%23”。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章