Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error expected on DataConnection when not establishing a connection #924

Open
arthuro555 opened this issue Feb 17, 2022 · 2 comments · May be fixed by #1125
Open

Error expected on DataConnection when not establishing a connection #924

arthuro555 opened this issue Feb 17, 2022 · 2 comments · May be fixed by #1125
Labels
client related to peerjs client feature suggestions for new features or enhancements help wanted looking for contributors

Comments

@arthuro555
Copy link

When a DataConnection fails to establish, for example, due to connecting to an invalid ID or to one's own ID, I would expect the dataConnection.on('error', () => {...}) callback to be executed. Instead, only peer.on('error', () => {}) catches such kinds of errors. This is especially annoying when you want to for example connect to multiple peers at once since we cannot know which one has failed to connect, making it hard to tell the user which peer(s) has issues.

@afrokick afrokick added help wanted looking for contributors feature suggestions for new features or enhancements labels Feb 20, 2022
@szcuipeng
Copy link

i need too. and now i use setTimeout instead.

@WofWca
Copy link
Contributor

WofWca commented Aug 26, 2023

This also applies to the 'unavailable-id' error (the reconnect case). That is, you have no context as to which peer the error relates to.

Responsible source code:

peerjs/lib/peer.ts

Lines 390 to 395 in 633cd84

case ServerMessageType.Expire: // The offer sent to a peer has expired without response.
this.emitError(
PeerErrorType.PeerUnavailable,
`Could not connect to peer ${peerId}`,
);
break;

I think Promise-based API would make it easier to resolve this .

WofWca added a commit to WofWca/peerjs that referenced this issue Aug 26, 2023
WofWca added a commit to WofWca/peerjs that referenced this issue Aug 26, 2023
jonasgloning added a commit to WofWca/peerjs that referenced this issue Sep 2, 2023
jonasgloning added a commit to WofWca/peerjs that referenced this issue Sep 3, 2023
@irgalamarr irgalamarr added the client related to peerjs client label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client related to peerjs client feature suggestions for new features or enhancements help wanted looking for contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants