node-rtc-connection 1.0.15 → 1.0.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-rtc-connection",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "WebRTC DataChannel implementation for Node.js with STUN, TURN, NAT traversal, and encryption. Pure Node.js, no native dependencies.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -616,10 +616,11 @@ class RTCPeerConnection extends EventEmitter {
616
616
  if (this._sctpTransport.state === 'connected') {
617
617
  for (const channel of this._dataChannels.values()) {
618
618
  if (channel.readyState === 'connecting') {
619
- channel._setStateToOpen();
620
-
621
- // Hook up channel to network transport
619
+ // Hook up channel to network transport first
622
620
  this._connectChannelToNetwork(channel);
621
+
622
+ // Then set state to open (emits 'open' event)
623
+ channel._setStateToOpen();
623
624
  }
624
625
  }
625
626
  }