Class WebSocketUpgradeActeur

java.lang.Object
com.mastfrog.acteurbase.AbstractActeur<Response,com.mastfrog.acteur.ResponseImpl,State>
com.mastfrog.acteur.Acteur
com.mastfrog.acteur.websocket.WebSocketUpgradeActeur

public class WebSocketUpgradeActeur extends Acteur
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
where the indented elements are constructed/called repeantedly for each WebSocketFrame.
Author:
Tim Boudreau
  • Field Details

    • SETTINGS_KEY_WEBSOCKET_SECURE_PROTOCOL

      public static final String 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

      public static final String 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

      public static final io.netty.util.AttributeKey<Supplier<? extends Chain<? extends Acteur,?>>> CHAIN_KEY
    • PAGE_KEY

      public static final io.netty.util.AttributeKey<Page> PAGE_KEY
  • Constructor Details