Package com.mastfrog.acteur.websocket
Class WebSocketUpgradeActeur
java.lang.Object
com.mastfrog.acteurbase.AbstractActeur<Response,com.mastfrog.acteur.ResponseImpl,State>
com.mastfrog.acteur.Acteur
com.mastfrog.acteur.websocket.WebSocketUpgradeActeur
Use in @Precursors annotation before acteurs which consume and produce
web socket responses. All acteurs following this one will be re-created and
called for each web socket event - so effectively the programming model is
still a chain of Acteurs; subsequent ones simply ask for a WebSocketEvent
instead of an HttpEvent to get their payload. Such acteurs can reply with
ok(someObject) to have the object converted to JSON per normal use and sent
on the websocket instead of as an http response. Header methods do nothing,
for obvious reasons, in acteurs that process websocket events.
As with any acteur, all objects provided by preceding acteurs in the chain may be injected into acteurs that process a websocket connection. So the pattern looks more like:
- Check url path (e.g. @Path annotation handler as normal)
- Check method (e.g. @Methods annotation handler as normal)
- Authenticate (e.g. @Authenticated triggers whatever acteur subclass you bound to AuthenticationActeur)
- WebSocketUpgradeActeur
- Event validity checker acteur
- Event processor acteur
- Author:
- Tim Boudreau
-
Nested Class Summary
Nested classes/interfaces inherited from class com.mastfrog.acteur.Acteur
Acteur.ConsumedLockedState, Acteur.ConsumedState, Acteur.Delegate, Acteur.RejectedState, Acteur.RespondWith -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final booleanstatic final io.netty.util.AttributeKey<Page>static final Stringstatic final StringFields inherited from class com.mastfrog.acteurbase.AbstractActeur
creationStackTrace -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWebSocketUpgradeActeur(HttpEvent evt, PathFactory paths, com.mastfrog.settings.Settings settings, Page page, Deferral defer, Chain chain, ApplicationControl ctrl, OnWebsocketConnect onConnect) -
Method Summary
Methods inherited from class com.mastfrog.acteur.Acteur
add, badRequest, badRequest, continueAfter, continueAfter, continueAfter, defer, deferThenRespond, deferThenRespond, dependencies, describeYourself, get, getContextContribution, getResponse, getState, next, noContent, notFound, notFound, ok, ok, reject, reply, reply, reply, response, setChunked, setMessage, setResponseBodyWriter, setResponseBodyWriter, setResponseCode, setResponseWriter, setResponseWriter, then, then, then, wrapMethods inherited from class com.mastfrog.acteurbase.AbstractActeur
setState
-
Field Details
-
SETTINGS_KEY_WEBSOCKET_SECURE_PROTOCOL
- See Also:
-
DEFAULT_WEBSOCKET_SECURE_PROTOCOL
public static final boolean DEFAULT_WEBSOCKET_SECURE_PROTOCOL- See Also:
-
SETTINGS_KEY_WEBSOCKET_FRAME_MAX_LENGTH
- See Also:
-
DEFAULT_WEBSOCKET_FRAME_MAX_LENGTH
public static final int DEFAULT_WEBSOCKET_FRAME_MAX_LENGTH- See Also:
-
CHAIN_KEY
-
PAGE_KEY
-
-
Constructor Details
-
WebSocketUpgradeActeur
@Inject protected WebSocketUpgradeActeur(HttpEvent evt, PathFactory paths, com.mastfrog.settings.Settings settings, Page page, Deferral defer, Chain chain, ApplicationControl ctrl, OnWebsocketConnect onConnect)
-