Connect HTML5 to Windows (low latency)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Vekepihvi

I want to have a server (Windows) and a client (HTML5). The client needs to send a Vector2 of 2 floats every frame to the server.

  1. What networking protocol should I use for the communication?
  2. How do I use it? (Please don’t link Godot’s documentation, it’s confusing for me)
  3. What IP address should I use to connect the peers? (192.168.###.### or the one with entirely random numbers, ###.###.###.###, the peers will always be in the same network)
  4. How do I get the correct IP addresses? (to display it on screen to help the user connect the devices)
  5. Does HTML5 even support IP.get_local_addresses()? When I tried, it didn’t seem to work.
:bust_in_silhouette: Reply From: avnih

.1. WebRTC — Godot Engine (stable) documentation in English
3. If you use your own computer for both the server and the client, use localhost (127.0. 0.1). Otherwise use the IP of the server you are using.
4. Easiest way it so hard-code the server’s IP (from answer #3) into your code, so the player won’t have to deal with IP addresses.
5. Normally the client is the one which initiates the connection, and not the server. Therefore you won’t need to know the client’s IP in advance, only the server’s IP.

Thank you, that will help me a lot.

But I can’t use localhost as the client is on my laptop and the server is on my desktop. Also, which IP address will I connect to? 192.168.###.### or the actually random one ###.###.###.###)?
3. Might as well hard-code it in, but that will ruin my plans on publishing this software for public usage.

Vekepihvi | 2021-04-13 17:00

  1. I’m not an expert about building networks at home. You will have to consult other resources, sorry.
  2. Don’t you plan to have a single server that all clients will use?

avnih | 2021-04-15 17:39