Suggestions

close search

StringeeConnectionListener

public interface StringeeConnectionListener



Monitors when the client connects or disconnects from Stringee server.



Summary


Public Constructors
StringeeConnectionListener()

Creates a new StringeeConnectionListener instance.

Public methods
void onConnectionConnected(StringeeClient client, boolean isReconnecting)

Invoked when the client connects to Stringee server.

void onConnectionDisconnected(StringeeClient client, boolean isReconnecting)

Invoked when the client disconnects from Stringee server

void onConnectionError(StringeeClient client, StringeeError error)

Invoked when the client fails to connect to Stringee server.

void onIncomingCall(StringeeCall stringeeCall)

Invoked when the client has an incoming call.

void onIncomingCall2(StringeeCall2 stringeeCall2)

Invoked when the client has an incoming call2.

void onRequestNewToken(StringeeClient client)

Invoked when the access token is expired. You must get a new access token and connect to Stringee server again.

void onCustomMessage(String from, JSONObject msg)

Invoked when the client receives a custom message from another client.


Public constructors


StringeeConnectionListener

StringeeConnectionListener()

Creates a new StringeeConnectionListener instance.



Public methods


onConnectionConnected

void onConnectionConnected(StringeeClient client, boolean isReconnecting)

Connects to Stringee server, using provided access token.

Parameters
client

The StringeeClient instance.

isReconnecting

Whether the client is reconnecting.



onConnectionDisconnected

void onConnectionDisconnected(StringeeClient client, boolean isReconnecting)

Invoked when the client disconnects from Stringee server

Parameters
client

The StringeeClient instance.

isReconnecting

Whether the client is reconnecting.



onConnectionError

void onConnectionError(StringeeClient client, StringeeError error)

Invoked when the client fails to connect to Stringee server.

Parameters
client

The StringeeClient instance.

error

The StringeeError instance contains the error code and message. Connection errors are described as following:

code = 1: Access token is missing.

code = 2: Access token can not be decoded.

code = 3: Access token format is invalid.

code = 4: HS256 must be used to generate the access token.

code = 5: API key is not found.

code = 6: Access token is expired or invalid.

code = 7: Access token payload is incorrect.

code = 8: Project is not found.



onIncomingCall

void onIncomingCall(StringeeCall stringeeCall)

Invoked when the client has an incoming call.

Parameters
stringeeCall

The StringeeCall instance.



onIncomingCall2

void onIncomingCall2(StringeeCall2 stringeeCall2)

Invoked when the client has an incoming call2.

Parameters
stringeeCall2

The StringeeCall2 instance.



onRequestNewToken

void onRequestNewToken(StringeeClient client)

Invoked when the access token is expired. You must get a new access token and connect to Stringee server again.

Parameters
client

The StringeeClient instance.



onCustomMessage

void onCustomMessage(String from, JSONObject msg)

Invoked when the client receives a custom message from another client.

Parameters
from

User id of the sender.

msg

Message in JSON format.