Class WebSocketFlusher

java.lang.Object
org.eclipse.jetty.websocket.core.util.WebSocketFlusher
All Implemented Interfaces:
OutgoingFrames
Direct Known Subclasses:
FragmentingFlusher

public abstract class WebSocketFlusher extends Object implements OutgoingFrames
This is used to iteratively transform or process a frame into one or more other frames. When a frame is ready to be processed onFrame(OutgoingEntry, boolean) is called. Subsequent calls to onFrame(OutgoingEntry, boolean) are after each time the entry is succeeded until one of these calls returns true to indicate they are done processing the frame and are ready to receive a new one.
  • Constructor Details

    • WebSocketFlusher

      public WebSocketFlusher()
  • Method Details

    • onFrame

      protected abstract boolean onFrame(OutgoingEntry entry, boolean first)
      Called when a frame is ready to be transformed.
      Parameters:
      entry - the entry containing the frame to be transformed.
      first - true if this is the first time this entry is being processed.
      Returns:
      true to indicate that you have finished transforming this entry.
    • onCompleteFailure

      protected void onCompleteFailure(Throwable cause)
      Called when the flusher has failed and onFrame(OutgoingEntry, boolean) will never be called again.
    • sendFrame

      public final void sendFrame(OutgoingEntry entry)
      Description copied from interface: OutgoingFrames
      Send an OutgoingEntry containing a Frame and Callback.
      Specified by:
      sendFrame in interface OutgoingFrames
      Parameters:
      entry - the frame to eventually write to the network layer.
    • closeFlusher

      public void closeFlusher()
      Used to close this flusher when there is no explicit failure.
    • failFlusher

      public void failFlusher(Throwable t)
      Used to fail this flusher possibly from an external event such as a callback.
      Parameters:
      t - the failure.