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”。


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