你好,我来到了scaledrone project,它可以正常工作,但不是我想要的 所以我决定将scaledrone编译为socket.io。一切都很好,但是我遇到了这个问题
function sendMessage(message) {
drone.publish({
room: roomName,
message
});
}
function startWebRTC(isOfferer) {
pc = new RTCPeerConnection(configuration);
// 'onicecandidate' notifies us whenever an ICE agent needs to deliver a
// message to the other peer through the signaling server
pc.onicecandidate = event => {
if (event.candidate) {
sendMessage({'candidate': event.candidate});
}
};
我知道onicecandidate是非常重要的功能,但我不知道如何在socket.io中编译drone.publish()
来使应用程序正常工作
这是我的socket.io代码
vchns.on('connection', async function(socket){
var vroom = vnumb
socket.join(vroom);
console.log('sucket connected to room ' + vroom)
socket.current_vidroom = vroom;
vchns.in(vroom).clients((err, clients)=>{
if(err) return false;
if(clients.length < 2){
vchns.in(socket.current_vidroom).emit('wait');
}
if(clients.length >= 2){
++vnumb
vchns.in(socket.current_vidroom).emit('stopwait');
}
})
})
这是客户端socket.io:
socket.on('wait', ()=>{
waitingdiv.style.display = "block"
})
socket.on('stopwait', ()=>{;
waitingdiv.style.display = "none"
alert('partner found');
})
那么我如何将其从scaledrone编译为socket.io?
谢谢!