@leofcoin/peernet 0.14.21 → 0.14.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -437,6 +437,7 @@ class Peer {
437
437
  this.#connection.ondatachannel = (message) => {
438
438
  message.channel.onopen = () => {
439
439
  this.#connected = true
440
+ debug(`peer:connected ${this}`)
440
441
  pubsub.publish('peer:connected', this)
441
442
  }
442
443
  message.channel.onclose = () => this.close.bind(this)
@@ -511,7 +512,7 @@ class Peer {
511
512
  if (message.to !== this.id) return
512
513
  // if (data.videocall) return this._startStream(true, false); // start video and audio stream
513
514
  // if (data.call) return this._startStream(true, true); // start audio stream
514
- if (this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
515
+ if (!this.#connection || this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
515
516
 
516
517
  if (message.candidate) {
517
518
  debug(`incoming candidate ${this.#channelName}`)
@@ -436,6 +436,7 @@ class Peer {
436
436
  this.#connection.ondatachannel = (message) => {
437
437
  message.channel.onopen = () => {
438
438
  this.#connected = true
439
+ debug(`peer:connected ${this}`)
439
440
  pubsub.publish('peer:connected', this)
440
441
  }
441
442
  message.channel.onclose = () => this.close.bind(this)
@@ -510,7 +511,7 @@ class Peer {
510
511
  if (message.to !== this.id) return
511
512
  // if (data.videocall) return this._startStream(true, false); // start video and audio stream
512
513
  // if (data.call) return this._startStream(true, true); // start audio stream
513
- if (this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
514
+ if (!this.#connection || this.#connection?.signalinState === 'stable' && this.#connection?.remoteDescription !== null && this.#connection?.localDescription !== null) return
514
515
 
515
516
  if (message.candidate) {
516
517
  debug(`incoming candidate ${this.#channelName}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "0.14.21",
3
+ "version": "0.14.23",
4
4
  "description": "",
5
5
  "source": "src/peernet.js",
6
6
  "main": "dist/commonjs/peernet.js",