I'm trying to connect multiple players ( godot clients) to 1 nodejs server and it's the second client would not connect. The first client connects, not the second.
All the relevant tutorials and projects that I found are written for Godot 3.0, therefore they are useless in 3.1 since 3.0 did not have support for websockets.
Any minimal multiplayer web sockets tutorial / code snippet or project, written for godot 3.1? Could you share minimal code?
Something like this won't work
extends Node var ws = null func _ready(): ws = WebSocketClient.new() ws.connect("connection_established", self, "_connection_established") ws.connect("connection_closed", self, "_connection_closed") ws.connect("connection_error", self, "_connection_error") var url = "ws://localhost:8080" print("Connecting to " + url) ws.connect_to_url(url) func _connection_established(protocol): print("Connection established with protocol: ", protocol) func _connection_closed(): print("Connection closed") func _connection_error(): print("Connection error") func _process(delta): if ws.get_connection_status() == ws.CONNECTION_CONNECTING || ws.get_connection_status() == ws.CONNECTION_CONNECTED: ws.poll() if ws.get_peer(1).is_connected_to_host(): ws.get_peer(1).put_var("HI") if ws.get_peer(1).get_available_packet_count() > 0 : var test = ws.get_peer(1).get_var() print('recieve %s' % test)