-
Notifications
You must be signed in to change notification settings - Fork 1
/
draft-yoshino-ws-over-wish.txt
280 lines (165 loc) · 9.34 KB
/
draft-yoshino-ws-over-wish.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
Network Working Group T. Yoshino
Internet-Draft W. Zhu
Intended status: Standards Track Google, Inc.
Expires: November 13, 2017 May 12, 2017
WebSocket over WiSH
draft-yoshino-ws-over-wish-00
Abstract
This document discusses how to bridge the WiSH framing (draft-
yoshino-wish) and WebSocket.
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 13, 2017.
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Yoshino & Zhu Expires November 13, 2017 [Page 1]
Internet-Draft WebSocket over WiSH May 2017
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Conformance Requirements and Terminology . . . . . . . . . . 2
3. Content Negotiation and WebSocket Compatibility Consideration 2
3.1. Subprotocol Negotiation . . . . . . . . . . . . . . . . . 3
3.2. Compression Negotiation . . . . . . . . . . . . . . . . . 3
4. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 4
5. References . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.1. Normative References . . . . . . . . . . . . . . . . . . 4
5.2. Non-normative References . . . . . . . . . . . . . . . . 5
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 5
1. Introduction
This document discusses how to bridge the WiSH framing (draft-
yoshino-wish) and WebSocket.
Once the WiSH idea is successfully adopted, binding to the WebSocket
API [WSAPI] could be introduced as further optimization for existing
WebSocket users.
2. Conformance Requirements and Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
Requirements phrased in the imperative as part of algorithms (such as
"strip any leading space characters" or "return false and abort these
steps") are to be interpreted with the meaning of the key word
("MUST", "SHOULD", "MAY", etc.) used in introducing the algorithm.
Conformance requirements phrased as algorithms or specific steps can
be implemented in any manner, so long as the end result is
equivalent. In particular, the algorithms defined in this
specification are intended to be easy to understand and are not
intended to be performant.
3. Content Negotiation and WebSocket Compatibility Consideration
In this section, we discuss how to bridge WiSH and WebSocket.
The JavaScript binding and wire protocol handshake with WebSocket
port is future work. Current thoughts are drafted at
[BidiwebWSOverWiSH]
Yoshino & Zhu Expires November 13, 2017 [Page 2]
Internet-Draft WebSocket over WiSH May 2017
3.1. Subprotocol Negotiation
When layered over HTTP, a client and server MAY choose to negotiate a
subprotocol (in the WebSocket term) to use by using the standard HTTP
"Accept" and "Content-Type" headers. In order to be compatible with
[RFC6455], a client MAY list offered subprotocols as follows:
Accept: application/web-stream; protocol=foo; q=1,
application/web-stream; protocol=bar; q=0.5
Following the "application/web-stream" media type, a parameter named
"protocol" is specified with the subprotocol name as its value. A
client offers multiple subprotocols by listing multiple "application/
web-stream" media type with the "protocol" parameter with different
values.
The client MAY indicate that the media type of the request body is
WiSH by using the "Content-Type" header as follows:
Content-Type: application/web-stream
Where compatibility with WebSocket matters, symmetric subprotocols
MUST be used. When multiple subprotocols are offered, a client MUST
NOT specify the "protocol" parameter because it's not determined
which subprotocol will be chosen by the server until the negotiation
is done. When a single subprotocol is offered, a client MAY specify
the "protocol" parameter which is the same as the one specified in
the "Accept" header.
The server chooses one subprotocol from the offered ones and notifies
the chosen subprotocol with the "Content-Type" header as follows:
Content-Type: application/web-stream; protocol=foo
The client SHOULD NOT start streaming any data (with the request
body) before the client receives all the response headers from the
server, which concludes the negotiation process.
Where compatibility with WebSocket doesn't matter, the "Content-Type"
header value MAY differ between the HTTP request and HTTP response.
This includes a combination of WiSH and non-WiSH media type.
3.2. Compression Negotiation
When layered over HTTP, a client and server MAY choose to negotiate a
compression to use by using the standard HTTP "Accept-Encoding" and
"Content-Encoding" headers. A client MAY list offered compression
methods as follows:
Yoshino & Zhu Expires November 13, 2017 [Page 3]
Internet-Draft WebSocket over WiSH May 2017
Accept-Encoding:
web-stream-deflate;
client_max_window_bits; server_max_window_bits=10, q=1,
web-stream-deflate;
client_max_window_bits; server_max_window_bits; q=0.5
Each element in the header value consists of the identifier of the
compression method followed by parameters configuring the method.
The "web-stream-deflate" compression method in the example shows how
the compression algorithm used for the "permessage-deflate" can be
configured for the example. This example includes the
"client_max_window_bits" for WebSocket compatibility which indicates
whether or not the client supports the "client_max_window_bits"
parameter.
The client MAY indicate use of the compression method for the HTTP
request body by using the "Content-Encoding" header as follows:
Content-Encoding: web-stream-deflate
The server chooses one compression method from the offered ones and
notifies the chosen compression method with the "Content-Encoding"
header as follows:
Content-Encoding: web-stream-deflate
The server MAY also choose not to include the "Content-Encoding"
header to indicate that it rejects use of any compression method.
The client SHOULD NOT start streaming any data (with the request
body) before the client receives all the response headers from the
server, which concludes the negotiation process.
4. Acknowledgements
Thank you to the following people for giving feedback to the
document: Ben Christensen, Costin Manolache, Kari Hurtta, Loic
Hoguin, Roberto Peon, Van Catha.
5. References
5.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/
RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
Yoshino & Zhu Expires November 13, 2017 [Page 4]
Internet-Draft WebSocket over WiSH May 2017
[RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", RFC
6455, DOI 10.17487/RFC6455, December 2011,
<http://www.rfc-editor.org/info/rfc6455>.
5.2. Non-normative References
[WSAPI] WHATWG, "HTML Living Standard - Web sockets", May 2017,
<https://html.spec.whatwg.org/multipage/
comms.html#network>.
[BidiwebWSOverWiSH]
bidiweb, "WebSocket over WiSH", May 2017, <https://github
.com/bidiweb/wish/blob/master/ws-over-wish.md>.
Authors' Addresses
Takeshi Yoshino
Google, Inc.
Email: [email protected]
Wenbo Zhu
Google, Inc.
Email: [email protected]
Yoshino & Zhu Expires November 13, 2017 [Page 5]