Closed chopin closed 4 months ago
I tested after switching to nostr, and encountered a similar error as following:
trystero-nostr.min.js:1 WebSocket connection to 'wss://relay.exit.pub/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
Tested ipfs. Error:
trystero-ipfs.min.js:1 WebSocket connection to 'wss://node-01.ac-cn-hongkong-c.wakuv2.prod.status.im:8000/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED
Tested mqtt. Error:
trystero-mqtt.min.js:1 WebSocket connection to 'wss://public.mqtthq.com:8084/mqtt' failed: Connection closed before receiving a handshake response
Hey @chopin — those errors look concerning but are totally normal and expected. Since Trystero piggybacks on open public networks, it's inevitable some of them will occasionally go down or deny connections to certain users. For that reason, the library uses redundancy: connecting to multiple relays at once, but only requiring one to work to achieve peer connections. Redundancy has default values depending on which strategy you use, but you can also customize the number by setting relayRedundancy
in the config passed to joinRoom()
.
It's not possible to catch socket connection errors in the browser, so you'll usually see failed relay connections in the console. Assuming other relays work, these errors shouldn't affect peer connection and your users won't see them unless they open the console. I might add a note to the docs explaining that these warnings are expected.
Thanks for your response. I checked that Trystero was working fine.
Coluld you please print such errors as warnings? Programmers are sensitive at any error message. I saw that the error messages repeated as time goes getting my attention. They bothers me because I have to look at all error messages for development.
There must be a way to catch websocket connection errors. There are a lot of web pages about it:
https://www.google.com/search?q=websocket+how+to+catch+connection+timeout+error
Trystero doesn't throw those warnings, they're part of default browser behavior when connections fail and can't be suppressed with a catch statement (see this explanation for details). It's an annoyance but you can hide it by setting a console filter in the browser dev tools.
Hi,
Thanks for sharing a wonderful library. I am trying to integrate Trystero for the first time, and I encountered connection failure in joinRoom(). Following is my code.
importing in html:
joinRoom() in Python (translated to javascript by Transcrypt):
result: connection failure at 'wss://tracker.files.fm:7073/announce'.
The code is so simple. What did I do wrong? Do I have to have a torrent id and register the appId in torrent?