summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-08-13 03:54:50 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-08-13 03:54:50 +0800
commit2fc9fd22084bb4a89a72be525c18fc409303ada5 (patch)
tree511734c255237e99ba0b5b302232073572faaa38 /docs
parent790deda0f38e36c7378ff05a9c234a56e14a5d6b (diff)
downloadcask-2fc9fd22084bb4a89a72be525c18fc409303ada5.tar.gz
cask-2fc9fd22084bb4a89a72be525c18fc409303ada5.tar.bz2
cask-2fc9fd22084bb4a89a72be525c18fc409303ada5.zip
Basic websocket support works
Diffstat (limited to 'docs')
-rw-r--r--docs/pages/1 - Cask: a Scala HTTP micro-framework .md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/pages/1 - Cask: a Scala HTTP micro-framework .md b/docs/pages/1 - Cask: a Scala HTTP micro-framework .md
index db35e6b..131d06b 100644
--- a/docs/pages/1 - Cask: a Scala HTTP micro-framework .md
+++ b/docs/pages/1 - Cask: a Scala HTTP micro-framework .md
@@ -299,6 +299,26 @@ Or globally, in your `cask.Main`:
$$$compress3
+### Websockets
+
+$$$websockets
+
+Cask's Websocket endpoints are very similar to Cask's HTTP endpoints. Annotated
+with `@cask.websocket` instead of `@cask.get` or `@cast.post`, the primary
+difference is that instead of only returning a `cask.Response`, you now have an
+option of returning a `io.undertow.websockets.WebSocketConnectionCallback`.
+
+The `WebSocketConnectionCallback` allows you to pro-actively start sending
+websocket messages once a connection has been made, and it lets you register a
+`AbstractReceiveListener` that allows you to react to any messages the client on
+the other side of the websocket connection sends you. You can use these two APIs
+to perform full bi-directional, asynchronous communications, as websockets are
+intended to be used for.
+
+Returning a `cask.Response` immediately closes the websocket connection, and is
+useful if you want to e.g. return a 404 or 403 due to the initial request being
+invalid.
+
### TodoMVC Api Server