Godot WebSocketClient can't connect to non-Godot WebSocketServer

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

Hi everyone,
I am trying to implement a NodeJS server which is connected to a MySQL database.
My Godot project is supposed to send queries to this server so it proceed a request into the databas and send the result to the godot WebSocketClient.

The problem is that this server works perfectly (tested with a NodeJS client), but when I try to connect my Godot project to it, nothing happens.

var address = "ws://localhost:1234"
var dbConnection = WebSocketClient.new()
dbConnection.connect("connection_established", self, "_connection_established_BDD")
dbConnection.connect("connection_closed", self, "_connection_closed_BDD")
var db_err = dbConnection.connect_to_url(address)
if(db_err != OK):
	print("Erreur lors de la connection au serveur de BDD")

 func _connection_established_BDD(id, proto=""):
print("Serveur connecté au serveur de base de données "+str(id))

func _connection_error_BDD():
print("Erreur lors de la connection au serveur de base de donnée")

Neither success function nor error function nor db_err prints anything, so I can’t find the problem.

Maybe somebody has an idea to solve it, or an easier solution to communicate between Godot and a mysql (or other) database ?

Thanks for your help

Hello! Did you find any solution?

K1llM3H4rd3r | 2022-02-12 17:44