Room room;
room.on(Room.RoomEventEnum.OPEN, new OnCallback() {
@Override
public void onCallback(Object object) {
if (!(object instanceof String)) return;
String roomName = (String)object;
}
});
room.on(Room.RoomEventEnum.CLOSE, new OnCallback() {
@Override
public void onCallback(Object object) {
if (!(object instanceof String)) return;
String roomName = (String)object;
}
});
room.on(Room.RoomEventEnum.ERROR, new OnCallback() {
@Override
public void onCallback(Object object) {
}
});
room.on(Room.RoomEventEnum.PEER_JOIN, new OnCallback() {
@Override
public void onCallback(Object object) {
if (!(object instanceof String)) return;
String peerId = (String)object;
}
});
room.on(Room.RoomEventEnum.PEER_LEAVE, new OnCallback() {
@Override
public void onCallback(Object object) {
if (!(object instanceof String)) return;
String peerId = (String)object;
}
});
room.on(Room.RoomEventEnum.DATA, new OnCallback2() {
@Override
public void onCallback(Object object) { }
@Override
public void onCallback(final Object object1, final Object object2) {
String peerId = (String)object1;
if (object2 instanceof String) {
String message = (String)object2;
}
else if (object2 instanceof byte[]) {
byte[] array = (byte[])object2;
}
}
});
room.on(Room.RoomEventEnum.LOG, new OnCallback() {
@Override
public void onCallback(Object object) {
if (!(object instanceof String[])) return;
String[] logs = (String[])object;
}
});