Alternative class as DataConnection.
More...
Inherits io.skyway.Peer.BaseConnection.
|
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" |
|
Alternative class as DataConnection.
◆ 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
-
forceClose | Set 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 | ) |
|
◆ getSerialization()
static String io.skyway.Peer.BaseConnection.getSerialization |
( |
SerializationEnum |
type | ) |
|
|
staticinherited |
Convert serialization enum type to string.
- Parameters
-
type | serialization 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
-
type | serialization type string |
- Returns
- serialization enum type
- See also
- #getSerialization(SerializationEnum)
◆ getStats()
Get statistics of the connection.
DataConnection connection;
connection.getStats(new StatsCollectorCallback() {
@Override
public void onStatsDelivered(JSONArray stats) {
}
});
- Parameters
-
◆ 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()
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
-
event | Event type. |
callback | Callback. |
◆ 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) {
} else {
}
- Parameters
-
data | data is sent to the remote peer. |
- Returns
- Method Result
◆ 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.