Closed PraxTube closed 1 year ago
I tested two more things:
This was successful! I had two peers on the same remote network connecting to the server. This worked without any issues.
This gave me the same errors as the attempt above.
I think that sometimes, it's just not possible to pierce through specific routers, setups, and you have to resort to a relay server (TURN).
You could try a couple of webrtc test sites and see if they successfully get a direct connection, between the peers you have trouble with, if they do, then it's hopefully something we can fix on our end.
Ah okay I see, that is actually kinda good news to me. I was a little but under the suspicion that you need more then the matchbox server to facilitate proper online signaling, but the server as it is right now is sufficient to connect peers across different networks? Running the matchbox server on a server with properly forwarded ports should be all you need to do in order for peers to connect to it, right?
I will definitely try out the webrtc tests, might me something with my router, though I also tested the connection of two peers on two different mobile data (using a hotspot) and that also didn't work. I also tested some other matchbox servers besides mine and got the same results, so who knows, will run those tests now. Thanks for your help, very much appreciated :+1:
Running the matchbox server on a server with properly forwarded ports should be all you need to do in order for peers to connect to it, right?
No, there are cases where webrtc on stun alone can't get a direct connection. You'll have to configure it with a TURN server. Those usually require some kind of authentication, otherwise people could exploit it as "free" service.
This is the API you need to use: https://docs.rs/matchbox_socket/latest/matchbox_socket/struct.RtcIceServerConfig.html
You could use xirsys.com free tier for testing development with a turn server, or run an instance of coturn if you have a place to easily/cheaply run docker containers.
EDIT: And sorry this isn't more clearly explained in the docs... Ideally, we'd have an example that uses TURN with a captcha or something.
Ahh okay I see, that makes a lot of sense. I will have a look at that.
EDIT: And sorry this isn't more clearly explained in the docs... Ideally, we'd have an example that uses TURN with a captcha or something.
No worries, glad you took your time to help me out :)
It works now 🎉 I had to setup a TURN server which I struggled a little bit with. In future versions this will be easier, but there are some pitfalls right now. More info in https://github.com/PraxTube/ace-of-the-heavens/issues/32.
@PraxTube Congrats. If any ways we can improve matchbox, please submit issues. Big picture items for TURN servers.
Thanks <3. It's mostly that there are some bugs that are already fixed in main
but aren't in the latest version yet. So you either have to use main
or create a fork with the necessary PR merged into it.
If I find any ways to improve this project, I will of course report them :+1:
I am using my own server to host a matchbox server and I tried to change it from only working locally to working globally. I tested it with my public IP address and a forwarded port, but it doesn't seem to work. The peers are able to connect to the server (see logs below), but it isn't able to establish a proper connection. Note that I am testing with one peer on the same local network as the server and one peer on a remote network.
When I have both peers in the local network things work fine. They connect without issue and my game plays like it did before. I didn't test to have both peers be remote, but if that is gonna work I am gonna lose it.
In the following
56.135.57.45
is my public IP address. Both ports2124
and3536
have been forwarded.Game Logs
The logs of the different network parties.
Matchbox Server Log
Local Peer Log
Both of the peer logs are practically identical (from what I can tell).
Note that after this point nothing happens anymore. I let it run for some minutes but nothing happend on either client or server side.
Remote Peer Log
Debuggin with Curl
I also tried to curl the server with both local and remote. In both cases I got the same (positive) result. Note that I am using a different port here, but both have been forwarded in the same manner. I also tried the
3536
port in the game and it got me the same results.Local Curl Log
Remote Curl Log
I have also a dummy HTML script on the server and have forwarded port
80
and I can successfully curl thehtml.index
file. That's why I highly doubt that port forwarding is the issue.