Android SDK API Reference

Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
io.skyway.Peer.DataConnection Class Reference

Alternative class as DataConnection. More...

Inherits io.skyway.Peer.BaseConnection.

Classes

enum  DataEventEnum
 Event type. More...
 

Public Member Functions

int bufferSize ()
 Get buffer size. More...
 
void on (DataEventEnum event, OnCallback callback)
 Set callbacks for data connection events. More...
 
boolean send (Object data)
 Data is sent to the remote peer. More...
 
void close ()
 Closes the data connection gracefully, cleaning up underlying DataChannels and PeerConnections. More...
 
void close (boolean forceClose)
 Closes the data connection gracefully, cleaning up underlying DataChannels and PeerConnections with the forceClose option. More...
 
void getStats (StatsCollectorCallback callback)
 Get statistics of the connection. More...
 
void finalize ()
 
boolean isOpen ()
 Get a connection open status. More...
 
String peer ()
 Get a peer ID. More...
 
String type ()
 Get a connection type. More...
 
String label ()
 Get a connection's label. More...
 
String connectionId ()
 Connection ID. More...
 
boolean reliable ()
 Data channel reliable. More...
 
SerializationEnum serialization ()
 Data channel serialization type. More...
 
String metadata ()
 Metadata string. More...
 
void getPeerConnectionState (OnCallback listener)
 
final Object peerConnection ()
 
Peer provider ()
 Parent Peer object. More...
 
final String browser ()
 
final Peer.PeerTypeEnum serverType ()
 

Static Public Member Functions

static String getSerialization (SerializationEnum type)
 Convert serialization enum type to string. More...
 
static SerializationEnum getSerializationEnum (String type)
 Convert string to serialization enum type. More...
 

Static Public Attributes

static final String TYPE_DATA = "data"
 
static final String TYPE_MEDIA = "media"
 
static final String SERIALIZATION_BINARY = "binary"
 
static final String SERIALIZATION_BINARY_UTF8 = "binary-utf8"
 
static final String SERIALIZATION_JSON = "json"
 
static final String SERIALIZATION_NONE = "none"
 

Detailed Description

Alternative class as DataConnection.

Member Function Documentation

◆ browser()

final String io.skyway.Peer.BaseConnection.browser ( )
inherited

◆ bufferSize()

int io.skyway.Peer.DataConnection.bufferSize ( )

Get buffer size.

Returns
buffer size.

◆ close() [1/2]

void io.skyway.Peer.DataConnection.close ( )

Closes the data connection gracefully, cleaning up underlying DataChannels and PeerConnections.

Run the forceClose option as false. May be changed to true from a future version.

DataConnection data;
data.close();
data = null;

◆ close() [2/2]

void io.skyway.Peer.DataConnection.close ( boolean  forceClose)

Closes the data connection gracefully, cleaning up underlying DataChannels and PeerConnections with the forceClose option.

DataConnection data;
data.close(true);
data = null;
Parameters
forceCloseSet to true and the connection on remote peer will close immediately. When set to false, the connection on remote peer will close after the end of the ICE reconnect by the browser.

◆ connectionId()

String io.skyway.Peer.DataConnection.connectionId ( )

Connection ID.

Returns
Connection ID.

◆ getPeerConnectionState()

void io.skyway.Peer.DataConnection.getPeerConnectionState ( OnCallback  listener)
Parameters
listenerlistener
Deprecated:

◆ getSerialization()

static String io.skyway.Peer.BaseConnection.getSerialization ( SerializationEnum  type)
staticinherited

Convert serialization enum type to string.

Parameters
typeserialization enum type
Returns
serialization type string
See also
#getSerializationEnum(String)

◆ getSerializationEnum()

static SerializationEnum io.skyway.Peer.BaseConnection.getSerializationEnum ( String  type)
staticinherited

Convert string to serialization enum type.

Parameters
typeserialization type string
Returns
serialization enum type
See also
#getSerialization(SerializationEnum)

◆ getStats()

void io.skyway.Peer.DataConnection.getStats ( StatsCollectorCallback  callback)

Get statistics of the connection.

DataConnection connection;
connection.getStats(new StatsCollectorCallback() {
@Override
public void onStatsDelivered(JSONArray stats) {
// Do something
}
});
Parameters
callbackCallback.

◆ isOpen()

boolean io.skyway.Peer.DataConnection.isOpen ( )

Get a connection open status.

Returns
Connection open status.

◆ label()

String io.skyway.Peer.DataConnection.label ( )

Get a connection's label.

Returns
Connection label.

◆ metadata()

String io.skyway.Peer.DataConnection.metadata ( )

Metadata string.

Returns
Metadata string.

◆ on()

void io.skyway.Peer.DataConnection.on ( DataEventEnum  event,
OnCallback  callback 
)

Set callbacks for data connection events.

DataConnection data;
data.on(DataConnection.DataEventEnum.OPEN, new OnCallback() {
@Override
public void onCallback(Object object) {
// オープンしたときの処理等を記述
}
});
data.on(DataConnection.DataEventEnum.DATA, new OnCallback() {
@Override
public void onCallback(Object object) {
// 処理を記述
}
});
data.on(DataConnection.DataEventEnum.CLOSE, new OnCallback() {
@Override
public void onCallback(Object object) {
// 処理を記述
}
});
data.on(DataConnection.DataEventEnum.ERROR, new OnCallback() {
@Override
public void onCallback(Object object) {
// 処理を記述
}
});
Parameters
eventEvent type.
callbackCallback.

◆ peer()

String io.skyway.Peer.DataConnection.peer ( )

Get a peer ID.

Returns
Peer ID.

◆ peerConnection()

final Object io.skyway.Peer.BaseConnection.peerConnection ( )
inherited

◆ provider()

Peer io.skyway.Peer.BaseConnection.provider ( )
inherited

Parent Peer object.

Returns
Parent Peer object.

◆ reliable()

boolean io.skyway.Peer.DataConnection.reliable ( )

Data channel reliable.

Returns
Data channel reliable.

◆ send()

boolean io.skyway.Peer.DataConnection.send ( Object  data)

Data is sent to the remote peer.

DataConnection* data;
String message = "Send data.";
boolean bResult = data.send(message);
if (bResult) {
// successful.
} else {
// failure.
}
Parameters
datadata is sent to the remote peer.
Returns
Method Result

◆ serialization()

SerializationEnum io.skyway.Peer.DataConnection.serialization ( )

Data channel serialization type.

Returns
Data channel serialization type.

◆ serverType()

final Peer.PeerTypeEnum io.skyway.Peer.BaseConnection.serverType ( )
inherited

◆ type()

String io.skyway.Peer.DataConnection.type ( )

Get a connection type.

Returns
Connection type.