Open louwers opened 1 month ago
When no connection can be made, this error is emitted:
https://github.com/peers/peerjs/blob/6bfc32015e5bc6df2fe1d502c071f80f2d4b278a/lib/peer.ts#L380
The docs state that:
Errors on the peer are almost always fatal and will destroy the peer
Of course, not being able to connect to another peer is definitely not fatal.
No response
I expected an error to be emitted to the connection as well.
I am not the only one.
If we look at this official(?) example
connectPeer: (id: string) => new Promise<void>((resolve, reject) => { if (!peer) { reject(new Error("Peer doesn't start yet")) return } if (connectionMap.has(id)) { reject(new Error("Connection existed")) return } try { let conn = peer.connect(id, {reliable: true}) if (!conn) { reject(new Error("Connection can't be established")) } else { conn.on('open', function() { console.log("Connect to: " + id) connectionMap.set(id, conn) resolve() }).on('error', function(err) { console.log(err) reject(err) }) } } catch (err) { reject(err) } }),
The Promise connectPeer returns will resolve if a peer cannot be connected to, since the error is not emitted to the connection.
connectPeer
Not really relevant.
This is not a bug but rather something unexpected.
I still think this is a bug, because there is no reliable way to extract which peer failed to connect from the error.
Please, check for existing issues to avoid duplicates.
What happened?
When no connection can be made, this error is emitted:
https://github.com/peers/peerjs/blob/6bfc32015e5bc6df2fe1d502c071f80f2d4b278a/lib/peer.ts#L380
The docs state that:
Of course, not being able to connect to another peer is definitely not fatal.
How can we reproduce the issue?
No response
What do you expected to happen?
I expected an error to be emitted to the connection as well.
I am not the only one.
If we look at this official(?) example
The Promise
connectPeer
returns will resolve if a peer cannot be connected to, since the error is not emitted to the connection.Environment setup
Not really relevant.
Is this a regression?
No response
Anything else?
No response