# Interface TransportListener

All Known Implementing Classes:
  `TransportAdapter`

public interface TransportListener

Receives everything the nearby transport has to say. Every method is called on the EDT.

Extend `TransportAdapter` rather than implementing all of this.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `connected(Endpoint endpoint)`
  A connection is open in both directions and payloads may be sent.
  `void`
  `connectionFailed(Endpoint endpoint, NearbyException error)`
  A connection attempt failed, or was rejected by the far side.
  `void`
  `connectionRequested(IncomingConnection request)`
  A peer wants to connect.
  `void`
  `disconnected(Endpoint endpoint)`
  An open connection closed, whether deliberately or because the peer went out of range.
  `void`
  `endpointFound(Endpoint endpoint)`
  A peer advertising the same service id came into view.
  `void`
  `endpointLost(Endpoint endpoint)`
  A discovered peer went away before any connection was made.
  `void`
  `payloadProgress(Endpoint endpoint, PayloadTransferUpdate update)`
  Progress on a payload being sent or received.
  `void`
  `payloadReceived(Endpoint endpoint, Payload payload)`
  A complete payload arrived.

- ## Method Details

  - ### endpointFound

    void endpointFound(Endpoint endpoint)

    A peer advertising the same service id came into view. Expect this repeatedly for the same endpoint across discovery sessions.

    ###### Parameters

    - `endpoint`: the peer that appeared

  - ### endpointLost

    void endpointLost(Endpoint endpoint)

    A discovered peer went away before any connection was made.

    ###### Parameters

    - `endpoint`: the peer that disappeared

  - ### connectionRequested

    void connectionRequested(IncomingConnection request)

    A peer wants to connect. Call `IncomingConnection.accept()` or `IncomingConnection.reject()`; a request that is never answered times out on the far side.

    ###### Parameters

    - `request`: the request to answer

  - ### connected

    void connected(Endpoint endpoint)

    A connection is open in both directions and payloads may be sent.

    ###### Parameters

    - `endpoint`: the connected peer

  - ### connectionFailed

    void connectionFailed(Endpoint endpoint, NearbyException error)

    A connection attempt failed, or was rejected by the far side.

    ###### Parameters

    - `endpoint`: the peer that did not connect
    - `error`: why

  - ### disconnected

    void disconnected(Endpoint endpoint)

    An open connection closed, whether deliberately or because the peer went out of range.

    ###### Parameters

    - `endpoint`: the peer that disconnected

  - ### payloadReceived

    void payloadReceived(Endpoint endpoint, Payload payload)

    A complete payload arrived.

    ###### Parameters

    - `endpoint`: who sent it
    - `payload`: what they sent

  - ### payloadProgress

    void payloadProgress(Endpoint endpoint, PayloadTransferUpdate update)

    Progress on a payload being sent or received.

    ###### Parameters

    - `endpoint`: the other end of the transfer
    - `update`: how far it has got