[*] 优化

This commit is contained in:
acgist
2022-11-26 12:38:11 +08:00
parent 474be08cc9
commit 56dc649279
3 changed files with 8 additions and 11 deletions

View File

@@ -57,7 +57,7 @@ const defaultRPCConfig = {
/** 信令配置 */ /** 信令配置 */
const signalConfig = { const signalConfig = {
/** 当前终端SN */ /** 当前终端SN */
sn: 'taoyao', sn: localStorage.getItem('taoyao.sn', 'taoyao'),
/** 当前版本 */ /** 当前版本 */
version: '1.0.0', version: '1.0.0',
// 信令授权 // 信令授权
@@ -484,7 +484,8 @@ function Taoyao(
/** WebRTC配置 */ /** WebRTC配置 */
this.webrtc = null; this.webrtc = null;
/** WebSocket地址 */ /** WebSocket地址 */
this.webSocket = webSocket; // "wss://192.168.1.100:8888/websocket.signal"
this.webSocket = webSocket || 'wss://' + location.host + '/websocket.signal';
/** 设备状态 */ /** 设备状态 */
this.audioEnabled = true; this.audioEnabled = true;
this.videoEnabled = true; this.videoEnabled = true;

View File

@@ -50,16 +50,8 @@
meetingId: null meetingId: null
}, },
mounted() { mounted() {
// 随机终端标识
if(signalConfig.sn === 'taoyao') {
let sn = localStorage.getItem('taoyao.sn');
if(sn) {
signalConfig.sn = sn;
}
console.debug('终端标识', sn);
}
let self = this; let self = this;
this.taoyao = new Taoyao("wss://192.168.1.100:8888/websocket.signal"); this.taoyao = new Taoyao();
this.remoteClient = this.taoyao.remoteClient; this.remoteClient = this.taoyao.remoteClient;
// 打开信令通道 // 打开信令通道
this.taoyao this.taoyao

View File

@@ -13,11 +13,14 @@ import com.acgist.taoyao.signal.client.ClientSession;
import com.acgist.taoyao.signal.event.client.ClientRegisterEvent; import com.acgist.taoyao.signal.event.client.ClientRegisterEvent;
import com.acgist.taoyao.signal.protocol.ProtocolMapAdapter; import com.acgist.taoyao.signal.protocol.ProtocolMapAdapter;
import lombok.extern.slf4j.Slf4j;
/** /**
* 终端注册信令 * 终端注册信令
* *
* @author acgist * @author acgist
*/ */
@Slf4j
@Protocol @Protocol
public class ClientRegisterProtocol extends ProtocolMapAdapter { public class ClientRegisterProtocol extends ProtocolMapAdapter {
@@ -40,6 +43,7 @@ public class ClientRegisterProtocol extends ProtocolMapAdapter {
StringUtils.equals(this.securityProperties.getUsername(), username) && StringUtils.equals(this.securityProperties.getUsername(), username) &&
StringUtils.equals(this.securityProperties.getPassword(), password) StringUtils.equals(this.securityProperties.getPassword(), password)
) { ) {
log.info("终端注册:{}", sn);
session.authorize(sn); session.authorize(sn);
message.setCode(MessageCode.CODE_0000); message.setCode(MessageCode.CODE_0000);
} else { } else {