+doc #19429 initial merge of docs-dev and docs

This commit is contained in:
Konrad Malawski 2016-01-13 16:25:24 +01:00
parent be0c8af4c0
commit 5a18d43435
501 changed files with 9876 additions and 3681 deletions

View file

@ -0,0 +1,27 @@
.. _-handleWebsocketMessages-:
handleWebsocketMessages
=======================
Signature
---------
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/WebsocketDirectives.scala
:snippet: handleWebsocketMessages
Description
-----------
The directive first checks if the request was a valid Websocket handshake request and if yes, it completes the request
with the passed handler. Otherwise, the request is rejected with an ``ExpectedWebsocketRequestRejection``.
Websocket subprotocols offered in the ``Sec-Websocket-Protocol`` header of the request are ignored. If you want to
support several protocols use the :ref:`-handleWebsocketMessagesForProtocol-` directive, instead.
For more information about the Websocket support, see :ref:`server-side-websocket-support-scala`.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/WebsocketDirectivesExamplesSpec.scala
:snippet: greeter-service

View file

@ -0,0 +1,31 @@
.. _-handleWebsocketMessagesForProtocol-:
handleWebsocketMessagesForProtocol
==================================
Signature
---------
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/WebsocketDirectives.scala
:snippet: handleWebsocketMessagesForProtocol
Description
-----------
Handles Websocket requests with the given handler if the given subprotocol is offered in the ``Sec-Websocket-Protocol``
header of the request and rejects other requests with an ``ExpectedWebsocketRequestRejection`` or an
``UnsupportedWebsocketSubprotocolRejection``.
The directive first checks if the request was a valid Websocket handshake request and if the request offers the passed
subprotocol name. If yes, the directive completes the request with the passed handler. Otherwise, the request is
either rejected with an ``ExpectedWebsocketRequestRejection`` or an ``UnsupportedWebsocketSubprotocolRejection``.
To support several subprotocols, for example at the same path, several instances of ``handleWebsocketMessagesForProtocol`` can
be chained using ``~`` as you can see in the below example.
For more information about the Websocket support, see :ref:`server-side-websocket-support-scala`.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/WebsocketDirectivesExamplesSpec.scala
:snippet: handle-multiple-protocols

View file

@ -0,0 +1,10 @@
.. _WebsocketDirectives:
WebsocketDirectives
===================
.. toctree::
:maxdepth: 1
handleWebsocketMessages
handleWebsocketMessagesForProtocol