chore(socketio): request to call another user
This commit is contained in:
parent
4319b58321
commit
e38a2cba9a
|
|
@ -20,12 +20,15 @@ io.on('connection', (socket) => {
|
||||||
|
|
||||||
socket.on("callUser", ({ userToCall, signalData, from }) => {
|
socket.on("callUser", ({ userToCall, signalData, from }) => {
|
||||||
console.log("user to call:",userToCall)
|
console.log("user to call:",userToCall)
|
||||||
let index = users.findIndex(x =>{ x.name === userToCall})
|
let index = users.findIndex(x =>{
|
||||||
|
return x.name === userToCall
|
||||||
|
})
|
||||||
|
console.log(index)
|
||||||
if (index >= 0){
|
if (index >= 0){
|
||||||
console.log("calling user named "+ users[index].name+" and id "+users[index].id)
|
console.log("calling user named "+ users[index].name+" and id "+users[index].id)
|
||||||
io.to(users[index].id).emit("callUser", { signal: signalData, from, name });
|
io.to(users[index].id).emit("callUser", { signal: signalData, from });
|
||||||
}else{
|
}else{
|
||||||
console.log("There is no user named "+userToCall+" or it's he/she is offline")
|
console.log("There is no user named "+userToCall+" or he/she is offline")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user