public abstract class WebSocket
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
WebSocket.In<A>
Deprecated.
Use Akka Streams instead.
|
static class |
WebSocket.MappedWebSocketAcceptor<In,Out>
Utility class for creating WebSockets.
|
static interface |
WebSocket.Out<A>
Deprecated.
Use Akka Streams instead.
|
| Modifier and Type | Field and Description |
|---|---|
static WebSocket.MappedWebSocketAcceptor<akka.util.ByteString,akka.util.ByteString> |
Binary
Acceptor for binary WebSockets.
|
static WebSocket.MappedWebSocketAcceptor<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.JsonNode> |
Json
Acceptor for JSON WebSockets.
|
static WebSocket.MappedWebSocketAcceptor<java.lang.String,java.lang.String> |
Text
Acceptor for text WebSockets.
|
| Constructor and Description |
|---|
WebSocket() |
| Modifier and Type | Method and Description |
|---|---|
abstract java.util.concurrent.CompletionStage<F.Either<Result,akka.stream.javadsl.Flow<Message,Message,?>>> |
apply(Http.RequestHeader request)
Invoke the WebSocket.
|
static <In,Out> WebSocket.MappedWebSocketAcceptor<In,Out> |
json(java.lang.Class<In> in)
Acceptor for JSON WebSockets.
|
static <A> LegacyWebSocket<A> |
reject(Result result)
Deprecated.
Use the WebSocket.accept*OrResult methods instead.
|
static <A> LegacyWebSocket<A> |
whenReady(java.util.function.BiConsumer<WebSocket.In<A>,WebSocket.Out<A>> callback)
Deprecated.
Use the WebSocket.accept* methods instead.
|
static <A> LegacyWebSocket<A> |
withActor(java.util.function.Function<akka.actor.ActorRef,akka.actor.Props> props)
Deprecated.
Use the WebSocket.accept* methods instead, with a flow created by wrapping a Sink.actorRef and
Source.actorRef.
|
public static final WebSocket.MappedWebSocketAcceptor<java.lang.String,java.lang.String> Text
public static final WebSocket.MappedWebSocketAcceptor<akka.util.ByteString,akka.util.ByteString> Binary
public static final WebSocket.MappedWebSocketAcceptor<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.JsonNode> Json
public abstract java.util.concurrent.CompletionStage<F.Either<Result,akka.stream.javadsl.Flow<Message,Message,?>>> apply(Http.RequestHeader request)
request - The request for the WebSocket.public static <In,Out> WebSocket.MappedWebSocketAcceptor<In,Out> json(java.lang.Class<In> in)
In - The websocket's input type (what it receives from clients)Out - The websocket's output type (what it writes to clients)in - The class of the incoming messages, used to decode them from the JSON.@Deprecated public static <A> LegacyWebSocket<A> whenReady(java.util.function.BiConsumer<WebSocket.In<A>,WebSocket.Out<A>> callback)
onReady method is
implemented using the specified BiConsumer<In<A>, Out<A>>A - the in/out type of the legacy websocketcallback - the callback used to implement onReadyjava.lang.NullPointerException - if the specified callback is null@Deprecated public static <A> LegacyWebSocket<A> reject(Result result)
A - the socket's in/out typeresult - The result that will be returned.@Deprecated public static <A> LegacyWebSocket<A> withActor(java.util.function.Function<akka.actor.ActorRef,akka.actor.Props> props)
A - the socket's in/out typeprops - The function used to create the props for the actor. The passed in argument is the upstream actor.