ConnectionListener Interface Reference

Overview

  • Package: com.twilio.client

The ConnectionListener interface defines a set of callbacks for events related to a Connection.

Tasks

NameDescriptionType
onConnectingCalled for a newly-created Connection when it is connecting to your Twilio application.Instance method
onConnectedCalled after the Connection has successfully connected to your Twilio application.Instance method
onDisconnectedCalled after the Connection has been disconnected, ignored, or rejected by either party.Instance method
onDisconnectedCalled when an error occurs on the specified connection.Instance method

Methods

void onConnecting(Connection inConnection)

Called for a newly-created Connection when it is connecting to your Twilio application.

When this occurs, Connection is in the State state.

Parameters
NameDescription
inConnectionThe Connection that has started connecting
Return Value

None


void onConnected(Connection inConnection)

Called after the Connection has successfully connected to your Twilio application.

Note that this does not necessarily mean your application has executed successfully; it only indicates that the connection has been established.

When this occurs the Connection will be in the State state.

Parameters
NameDescription
inConnectionThe Connection that has finished connecting
Return Value

None


void onDisconnected(Connection inConnection)

Called after the Connection has been disconnected, ignored, or rejected by either party.

When this occurs the Connection will be in the State state.

Parameters
NameDescription
inConnectionThe Connection that has disconnected
Return Value

None


void onDisconnected(Connection inConnection, int inErrorCode, String inErrorMessage)

Called when an error occurs on the specified connection.

After this callback has been called, it is safe to assume that the connection is no longer connected.

When this occurs the Connection will be in the State state.

For a list of error codes and their meanings, see http://www.twilio.com/docs/client/errors.

Parameters
NameDescription
inConnectionThe Connection that has experienced an error
inErrorCodeThe error code that pinpoints the error
inErrorMessageA string describing the error in a human-readable form
Return Value

None