Interface BlinkProtocol

All Known Implementing Classes:
BinaryMsgSession, BlinkSession

public interface BlinkProtocol
A protocol that sits on top of a connection and decodes the incoming data.
Since:
1.0
Version:
2022-08-30
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when the underlying connection is closed.
    Return the read buffer to read channel data into.
    void
    Process incoming data placed in the read buffer.
  • Method Details

    • getReadBuf

      ByteBuffer getReadBuf()
      Return the read buffer to read channel data into.
    • read

      void read() throws IOException
      Process incoming data placed in the read buffer. Ideally read() will do one of the following:

      - Consume all of the data and clear the buffer before returning. - Consume some of the data and compress the remaining to the front of the buffer.

      Beware that if you do not consume all of the data in the hope that you'll get a complete message on the next callback, it's entirely possible that the message you're waiting for won't fit in the receive buffer in which case you'll get stuck. Incomplete processing of data is only really safe if you're waiting for the rest of a fixed size header to be received or something like that.

      Throws:
      IOException - throwing this will close the connection
    • disconnect

      void disconnect()
      Called when the underlying connection is closed.