-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Following code doesn't generate any errors or warnings, but con.send does not trigger con.on('data',fn) on the remote peer application.
const peer = new Peer();
peer.on('open',(id)=>{
console.log("Your peer id: "+id);
firebase.firestore().doc("peers/"+phoneNumber).set({
phoneNumber,
id,
timestamp: Date.now()
});
firebase.firestore().collection("peers").onSnapshot(snap=>{
snap.forEach(doc=>{
let data = doc.data();
if(data.phoneNumber==phoneNumber)
return;
console.log(data.id);
let conn = peer.connect(data.id,{
label: data.phoneNumber,
serialization:'json'
});
})
});
})
peer.on("connection",(conn)=>{
conn.on('open', function() {
console.log(`Connected to ${conn.peer}`);
conn.send({ value: 'hello' });
console.log("Sent");
});
conn.on('data', function(data) {
console.log('Received', data);
});
conn.on('error',(error)=>{
console.log(`Peer error on ${conn.label} (${conn.id}): ${error}`);
})
})
peer.on('close',()=>{
console.log("Connection was closed");
})
peer.on('disconnected',()=>{
console.log("Got disconnected");
})
peer.on('error',(err)=>{
console.log("Peer error occurred: ",err.type);
})
DinoscapeProgramming
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed