Open mdoleh opened 5 years ago
Source code for linked examples, uses Express to serve the client page and host the server:
Create-A-Basic-Multiplayer-Game-In-Phaser-3-With-Socket.io-Part-2.zip
Was able to get a successful socket connection with a custom URL in the client:
this.socket = io("http://localhost:8081");
Could theoretically have players host their own server and act as host to their own game sessions. Provide them the server host with all the required functionality, they run it locally and provide other players with the IP address to connect.
Able to access from the internet with router port forwarding enabled.
Note: only works from outside the internal network using the public IP address. Internal network can just use local IP. Both require port forwarding on router.
Reference for .NET library that can automatically do port forwarding on universal plug and play (UPnP) routers: https://www.fluxbytes.com/csharp/upnp-port-forwarding-the-easy-way/
NodeJS modules that can handle NAT UPnP configuration:
Edit: couldn't get the former to work, but the latter appears to work. Have a working example in simple-socket-io-game project.