WebSocketDirectives

org.apache.pekko.http.scaladsl.server.directives.WebSocketDirectives

Attributes

Source
WebSocketDirectives.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Directives
object Directives
class HttpApp

Members list

Grouped members

WebSocket directives

Extract the list of WebSocket subprotocols as offered by the client in the Sec-WebSocket-Protocol header if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Extract the list of WebSocket subprotocols as offered by the client in the Sec-WebSocket-Protocol header if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Attributes

Source
WebSocketDirectives.scala

Extract the UpgradeToWebSocket header if existent. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Extract the UpgradeToWebSocket header if existent. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Attributes

Deprecated
[Since version Akka HTTP 10.2.0]
Source
WebSocketDirectives.scala

Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection, otherwise.

Attributes

Source
WebSocketDirectives.scala

Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

Attributes

Source
WebSocketDirectives.scala

Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

Handles WebSocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection.

If the subprotocol parameter is None any WebSocket request is accepted. If the subprotocol parameter is Some(protocol) a WebSocket request is only accepted if the list of subprotocols supported by the client (as announced in the WebSocket request) contains protocol. If the client did not offer the protocol in question the request is rejected with an UnsupportedWebSocketSubprotocolRejection rejection.

To support several subprotocols you may chain several handleWebSocketMessagesForOptionalProtocol routes.

Attributes

Source
WebSocketDirectives.scala
def handleWebSocketMessagesForProtocol(handler: Flow[Message, Message, Any], subprotocol: String): Route

Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with an ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection.

Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with an ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection.

Attributes

Source
WebSocketDirectives.scala