[*] 日常优化
This commit is contained in:
@@ -39,7 +39,7 @@ public class SessionManager {
|
||||
public Session call(Client source, Client target) {
|
||||
final Session session = new Session(this.idService.buildUuid(), source, target);
|
||||
this.sessions.put(session.getId(), session);
|
||||
log.info("创建视频会话:{} - {} - {}", session.getId(), session.getSourceClientId(), session.getTargetClientId());
|
||||
log.info("创建会话:{} - {} - {}", session.getId(), session.getSourceClientId(), session.getTargetClientId());
|
||||
return session;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SessionManager {
|
||||
public Session remove(String sessionId) {
|
||||
final Session session = this.sessions.remove(sessionId);
|
||||
if(session != null) {
|
||||
log.info("移除视频会话:{} - {} - {}", sessionId, session.getSourceClientId(), session.getTargetClientId());
|
||||
log.info("移除会话:{} - {} - {}", sessionId, session.getSourceClientId(), session.getTargetClientId());
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
@@ -14,11 +14,14 @@ import com.acgist.taoyao.signal.event.session.SessionCloseEvent;
|
||||
import com.acgist.taoyao.signal.party.session.Session;
|
||||
import com.acgist.taoyao.signal.protocol.ProtocolSessionAdapter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 关闭媒体信令
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
@Slf4j
|
||||
@Protocol
|
||||
@Description(
|
||||
body = """
|
||||
@@ -39,13 +42,16 @@ public class SessionCloseProtocol extends ProtocolSessionAdapter implements Appl
|
||||
@Override
|
||||
public void onApplicationEvent(SessionCloseEvent event) {
|
||||
final Session session = event.getSession();
|
||||
final Map<String, String> body = Map.of(Constant.SESSION_ID, event.getSessionId());
|
||||
session.push(this.build(body));
|
||||
session.push(this.build(Map.of(
|
||||
Constant.SESSION_ID,
|
||||
event.getSessionId()
|
||||
)));
|
||||
this.sessionManager.remove(session.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String clientId, ClientType clientType, Session session, Client client, Message message, Map<String, Object> body) {
|
||||
log.info("关闭会话:{}", session.getId());
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolSessionAdapter;
|
||||
body = """
|
||||
{
|
||||
"sdp" : "sdp"
|
||||
"type" : "offer",
|
||||
"sessionId": "会话ID"
|
||||
}
|
||||
{
|
||||
"sdp" : "sdp"
|
||||
"type" : "answer",
|
||||
"type" : "offer|answer",
|
||||
"sessionId": "会话ID"
|
||||
}
|
||||
{
|
||||
@@ -39,7 +34,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolSessionAdapter;
|
||||
"sessionId": "会话ID",
|
||||
"candidate": {
|
||||
"sdpMid" : "sdpMid",
|
||||
"candidate" : "candidate信息",
|
||||
"candidate" : "candidate",
|
||||
"sdpMLineIndex": sdpMLineIndex
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user