“LimitedConnectionError on Supposedly ‘non-limited’ Connection to Behind-NAT Peer” #2908
-
Title: “ Summary of the Problem
Essentially, the dialer’s logs claim the new route to the listener is non-limited, yet opening a chat stream fails with a “LimitedConnectionError.” This contradictory state suggests that even though the connection manager says “non-limited=false,” the actual transport path remains in a partially upgraded or limited state. Specs
Help Needed relay.js:
dialer.js
listener
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I'm not sure this code is correct: const isLimited = (conn.stat?.status === 'LIMITED') If you consult the API docs for the Connection interface there's no "stat" property. You can tell if a connection has time/data limits via the .limits property, so instead you can do something like this: const isLimited = Boolean(connection.limits) Also in your examples the dialler dials the listener via the relay - it doesn't make a direct connection afterwards (using WebRTC or similar) so yes, it would be expected that the connection has limits applied. |
Beta Was this translation helpful? Give feedback.
-
Thanks @achingbrain for your response! You're correct, the dialer contacts the listener through the relay without establishing a direct connection afterward (like WebRTC). If I use WebRTC, the direct connection works fine. However, if anyone needs to override this behavior for any reason, the following snippet can be used: // Dial the listener directly using protocol '/chat/1.0.0'
const stream = await node.dialProtocol(listenerPeerId, '/chat/1.0.0', { runOnLimitedConnection: true }); |
Beta Was this translation helpful? Give feedback.
I'm not sure this code is correct:
If you consult the API docs for the Connection interface there's no "stat" property.
You can tell if a connection has time/data limits via the .limits property, so instead you can do something like this:
Also in your examples the dialler dials the listener via the relay - it doesn't make a direct connection afterwards (using WebRTC or similar) so yes, it would be expected that the connection has limits applied.