0 votes

Hi Everybody!

I trying to do a multiplayer game using websocket.

The signal "connection_established" seems not working.

peer.connect("connection_established", self, "_connected")

Here is the code to initialize the websocket connection (client):

func init_connection():
get_tree().connect("network_peer_disconnected", self, "_peer_disconnected")
get_tree().connect("network_peer_connected", self, "_peer_connected")
peer = WebSocketClient.new()
peer.connect("connection_failed", self, "_close_network")
peer.connect("connection_established", self, "_connected")
peer.connect_to_url("ws://" + IPServer + ":" + str(DEF_PORT), PoolStringArray([PROTO_NAME]), true)

What I understood is that connect("connectionestablished", self, "connected") must be connected to get_tree() but I get this error when I trying:

connect: In Object of type 'SceneTree': Attempt to connect nonexistent signal 'connection_established' to method 'Node._connected'.

function peerconnected works but _connected is never call.

Is somebody have an idea?

Regards, Foreman21.

Godot version 3.3.3.stable
in Engine by (56 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 Frequently asked questions and 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 [email protected] with your username.