@@ -222,28 +222,44 @@ For example:
222222## 3. Websockets
223223
224224A HTTP request can be promoted into a websocket by means of an
225- "upgrade" header.
225+ "" upgrade" header.
226226
227227In this situation, a Ring handler may choose to respond with a
228228websocket response instead of a HTTP response.
229229
230230### 3.1. Websocket Responses
231231
232- A websocket response is a map that has the ` :ring.websocket/listener `
233- key, which maps to a websocket listener, described in section 3.2 .
232+ A websocket response is a map that represents a WebSocket, and may be
233+ returned from a handler in place of a response map .
234234
235235``` clojure
236236(fn [request]
237237 #:ring.websocket{:listener websocket-listener})
238238```
239239
240- A websocket response may be returned from a synchronous listener, or
241- via the response callback of an asynchronous listener.
240+ It may also be used from an asynchronous handler.
242241
243242``` clojure
244243(fn [request respond raise]
245244 (respond #:ring.websocket{:listener websocket-listener}))
246- ```
245+
246+ A websocket response contains the following keys. Any key not marked as
247+ **required** may be omitted.
248+
249+ | Key | Type | Required |
250+ | ------------------------ | ----------------------- | -------- |
251+ |`:ring.websocket/listener`|`ring.websocket/Listener`| Yes |
252+ |`:ring.websocket/protocol`|`String` | |
253+
254+ #### :ring.websocket/listener
255+
256+ An event listener that satisfies the `ring.websocket/Listener` protocol,
257+ as described in section 3.2 .
258+
259+ #### :ring.websocket/protocol
260+
261+ An optional websocket subprotocol. Must be one of the values listed in
262+ the `Sec-Websocket-Protocol` header on the request.
247263
248264### 3.2 . Websocket Listeners
249265
0 commit comments