peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.49k stars 1.43k forks source link

Could not connect - not firing... #1298

Open MarketingPip opened 2 months ago

MarketingPip commented 2 months ago

Please, check for existing issues to avoid duplicates.

What happened?

When a false / non existing ID is given from a string it doesn't fire a error.

Example:

import { Peer } from "https://esm.sh/peerjs";

let peer = new Peer();
let peerId = "112dffddff";

peerId = peerId.trim();

const conn = peer.connect(peerId);

conn.on("error", (err) => {
  console.log(err);
});

But oddly when grabbing string ie ID from my function - await term.input() from my - Termino.js library - see here

Like this: Example:

import { Peer } from "https://esm.sh/peerjs";

let peer = new Peer();
let peerId =  await term.input()

const conn = peer.connect(peerId);

conn.on("error", (err) => {
  console.log(err);
});

It does fire....

How can we reproduce the issue?

No response

What do you expected to happen?

Events to fire correctly.

Environment setup

Is this a regression?

No response

Anything else?

No response