Interface MessageSink

All Known Implementing Classes:
AbstractDecodedMessageSink, AbstractDecodedMessageSink.Basic, AbstractDecodedMessageSink.Stream, AbstractMessageSink, ByteArrayMessageSink, ByteBufferMessageSink, ByteBufferMessageSink, DecodedBinaryMessageSink, DecodedBinaryStreamMessageSink, DecodedTextMessageSink, DecodedTextStreamMessageSink, DispatchedMessageSink, InputStreamMessageSink, MessageInputStream, MessageReader, PartialByteArrayMessageSink, PartialByteBufferMessageSink, PartialByteBufferMessageSink, PartialStringMessageSink, ReaderMessageSink, StringMessageSink

public interface MessageSink

A consumer of WebSocket data frames (either BINARY or TEXT).

FrameHandler delegates the processing of data frames to MessageSink, including the processing of the demand for the next frames.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(Frame frame, Callback callback)
    Consumes the WebSocket frame, possibly asynchronously when this method has returned.
    default void
    fail(Throwable failure)
    Fails this MessageSink with the given cause.
  • Method Details

    • accept

      void accept(Frame frame, Callback callback)

      Consumes the WebSocket frame, possibly asynchronously when this method has returned.

      The callback argument must be completed when the frame payload is consumed.

      The demand for more frames must be explicitly invoked, or arranged to be invoked asynchronously, by the implementation of this method, by calling CoreSession.demand().

      Parameters:
      frame - the frame to consume
      callback - the callback to complete when the frame is consumed
    • fail

      default void fail(Throwable failure)

      Fails this MessageSink with the given cause.

      Parameters:
      failure - the cause of the failure