asdf
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
let peerConnection = null;
|
||||
let currentStream = null;
|
||||
let dataChannel = null;
|
||||
let connection = false;
|
||||
// 메인 프로세스로부터 명령 수신 (IPC)
|
||||
console.log('electronAPI:', window.electronAPI);
|
||||
@@ -53,6 +54,16 @@ window.electronAPI.receive('start-webrtc', async (data) => {
|
||||
window.electronAPI.send('icecandidate', {type: 'icecandidate', targetId: data.targetId, server:'agent', 'candidate': event.candidate});
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
peerConnection.ondatachannel = (event) => {
|
||||
console.log('datachannel', event);
|
||||
dataChannel = event.channel;
|
||||
dataChannel.onmessage = (event) => {
|
||||
window.electronAPI.send('inputEvent', JSON.parse(event.data))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
window.electronAPI.receive('displays', async (data) => {
|
||||
@@ -66,5 +77,10 @@ window.electronAPI.receive('icecandidate', async (data) => {
|
||||
}
|
||||
});
|
||||
|
||||
window.electronAPI.receive('disconnect', async (data) => {
|
||||
peerConnection.close();
|
||||
peerConnection = null;
|
||||
});
|
||||
|
||||
// desktopCapturer 사용을 위해 preload 필요
|
||||
// → 다음 단계에서 preload.js 설정
|
||||
Reference in New Issue
Block a user