[*] 日常优化

This commit is contained in:
acgist
2023-08-29 08:09:25 +08:00
parent 9d2c183fcc
commit d11e8e058e
3 changed files with 79 additions and 41 deletions

View File

@@ -96,7 +96,15 @@ public class RoomManager {
// mediaClient.request(clone);
// 更新媒体服务
room.setMediaClient(mediaClient);
// TODO通知重建房间
if(room.getPassword() != null) {
clone.setBody(Map.of(
Constant.ROOM_ID, room.getRoomId(),
Constant.PASSWORD, room.getPassword()
));
}
room.getClients().forEach((client, wrapper) -> {
client.push(clone);
});
});
}

View File

@@ -33,6 +33,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolClientAdapter;
""",
"""
{
"roomId" : "房间ID",
"name" : "房间名称",
"clientSize" : "终端数量",
"mediaClientId": "媒体服务ID"
@@ -56,13 +57,12 @@ public class RoomCreateProtocol extends ProtocolClientAdapter implements Applica
@Override
public void onApplicationEvent(MediaServerRegisterEvent event) {
this.roomManager.recreate(event.getClient(), this.build());
// TODO通知
}
@Override
public void execute(String clientId, ClientType clientType, Client client, Message message, Map<String, Object> body) {
if(clientType.isClient()) {
// WEB同步创建房间
final Room room = this.roomManager.create(
MapUtils.get(body, Constant.NAME),
MapUtils.get(body, Constant.PASSWORD),
@@ -70,8 +70,7 @@ public class RoomCreateProtocol extends ProtocolClientAdapter implements Applica
message.cloneWithoutBody()
);
message.setBody(room.getRoomStatus());
// 通知媒体终端
this.clientManager.broadcast(message, ClientType.MEDIA_CLIENT_TYPE);
client.push(message);
} else {
this.logNoAdapter(clientType);
}