catch errors when sending messages
This commit is contained in:
parent
8adefb1da9
commit
c684411cf3
1 changed files with 6 additions and 2 deletions
|
@ -104,7 +104,9 @@ const readPeerMessage = (peerConn, buf) => {
|
||||||
*/
|
*/
|
||||||
const sendWebrtcConn = (webrtcConn, encoder) => {
|
const sendWebrtcConn = (webrtcConn, encoder) => {
|
||||||
log('send message to ', logging.BOLD, webrtcConn.remotePeerId, logging.UNBOLD, logging.GREY, ' (', webrtcConn.room.name, ')', logging.UNCOLOR)
|
log('send message to ', logging.BOLD, webrtcConn.remotePeerId, logging.UNBOLD, logging.GREY, ' (', webrtcConn.room.name, ')', logging.UNCOLOR)
|
||||||
|
try {
|
||||||
webrtcConn.peer.send(encoding.toUint8Array(encoder))
|
webrtcConn.peer.send(encoding.toUint8Array(encoder))
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +117,9 @@ const broadcastWebrtcConn = (room, encoder) => {
|
||||||
log('broadcast message in ', logging.BOLD, room.name, logging.UNBOLD)
|
log('broadcast message in ', logging.BOLD, room.name, logging.UNBOLD)
|
||||||
const m = encoding.toUint8Array(encoder)
|
const m = encoding.toUint8Array(encoder)
|
||||||
room.webrtcConns.forEach(conn => {
|
room.webrtcConns.forEach(conn => {
|
||||||
|
try {
|
||||||
conn.peer.send(m)
|
conn.peer.send(m)
|
||||||
|
} catch (e) {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue