优化打包

This commit is contained in:
2026-01-22 14:36:49 +08:00
parent 599c24181d
commit 369e222b50
2 changed files with 5 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ public class WebRTCSignalingServer {
@OnOpen @OnOpen
public void onOpen(Session session, @PathParam("userId") String userId) { public void onOpen(Session session, @PathParam("userId") String userId) {
clients.put(userId, session); clients.put(userId, session);
System.out.println("用户连接: " + userId); logger.info("onOpen: 用户连接: " + userId);
} }
@OnMessage @OnMessage
@@ -50,7 +50,7 @@ public class WebRTCSignalingServer {
if (targetSession != null && targetSession.isOpen()) { if (targetSession != null && targetSession.isOpen()) {
// 转发信令SDP, ICE, 拒绝/接受) // 转发信令SDP, ICE, 拒绝/接受)
targetSession.getAsyncRemote().sendText(message); targetSession.getAsyncRemote().sendText(message);
System.out.println("信令类型 [" + signal.getType() + "] 从 " + userId + " 发往 " + toUser); logger.info("onMessage: 信令类型 [" + signal.getType() + "] 从 " + userId + " 发往 " + toUser);
} else { } else {
sendErrorMessage(session, "目标用户不在线: " + toUser); sendErrorMessage(session, "目标用户不在线: " + toUser);
} }
@@ -62,12 +62,13 @@ public class WebRTCSignalingServer {
@OnClose @OnClose
public void onClose(@PathParam("userId") String userId) { public void onClose(@PathParam("userId") String userId) {
clients.remove(userId); clients.remove(userId);
System.out.println("用户离开: " + userId); logger.info("onClose: 用户离开: " + userId);
} }
@OnError @OnError
public void onError(Session session, Throwable error) { public void onError(Session session, Throwable error) {
error.printStackTrace(); error.printStackTrace();
logger.info("onError: " + error.getMessage());
} }
private void sendErrorMessage(Session session, String errorMsg) { private void sendErrorMessage(Session session, String errorMsg) {

View File

@@ -3,7 +3,7 @@ package com.ttstd.signaling;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class OneKeyCallWebRtcSignalingApplicationTests { class OneKeyCallWebRtcSignalingApplicationTests {
@Test @Test