Get Started

ConnectionListener Interface Reference

Overview

  • Package: com.twilio.client

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

Tasks

Name Description Type
onConnecting Called for a newly-created Connection when it is connecting to your Twilio application. Instance method
onConnected Called after the Connection has successfully connected to your Twilio application. Instance method
onDisconnected Called after the Connection has been disconnected, ignored, or rejected by either party. Instance method
onDisconnected Called 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
Name Description
inConnection The 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
Name Description
inConnection The 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
Name Description
inConnection The 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
Name Description
inConnection The Connection that has experienced an error
inErrorCode The error code that pinpoints the error
inErrorMessage A string describing the error in a human-readable form
Return Value

None