0 votes

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_error",self,"_connection_error_BDD")
dbConnection.connect("connection_closed", self, "_connection_closed_BDD")
dbConnection.connect("data_received",self,"_data_received_BDD")
var db_err = dbConnection.connect_to_url(address)
if(db_err != OK):
    print("Erreur lors de la connection au serveur de BDD")
    set_process(false)

 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

Godot version 3.2.3
in Engine by (21 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.