org.springframework.messaging.tcp

## Interface TcpConnection<P>

- Type Parameters:
    `P` - the type of payload for outbound `Message`s
  All Known Implementing Classes:
    ReactorTcpConnection

      public interface TcpConnection<P>

  A contract for sending messages and managing a TCP connection.
  Since:
    4.0
  Author:
    Rossen Stoyanchev

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the connection.
    `void` | `onReadInactivity(Runnable runnable, long duration)` Register a task to invoke after a period of of read inactivity.
    `void` | `onWriteInactivity(Runnable runnable, long duration)` Register a task to invoke after a period of of write inactivity.
    `ListenableFuture<Void>` | `send(Message<P> message)` Send the given message.

- - ### Method Detail

    - #### send

          ListenableFuture<Void> send(Message<P> message)

      Send the given message.
      Parameters:
        `message` - the message
      Returns:
        a ListenableFuture that can be used to determine when and if the message was successfully sent

    - #### onReadInactivity

          void onReadInactivity(Runnable runnable,
                                long duration)

      Register a task to invoke after a period of of read inactivity.
      Parameters:
        `runnable` - the task to invoke
        `duration` - the amount of inactive time in milliseconds

    - #### onWriteInactivity

          void onWriteInactivity(Runnable runnable,
                                 long duration)

      Register a task to invoke after a period of of write inactivity.
      Parameters:
        `runnable` - the task to invoke
        `duration` - the amount of inactive time in milliseconds

    - #### close

          void close()

      Close the connection.