The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Good afternoon,
I am trying to setup a simple websocket client following this documentation.
The problem is, even if the code is identical to the one in the guide, no websocket packet is received by the server.
I tried to use both put_packet and put_var, in addition to trying to change the write mode using:


The websocket server is written in Java using Undertow and, after making some tests, I concluded that it is working fine because it can receive packets from other sources, but not from Godot.
Opening and closing the connection works perfectly fine and I am able to receive data from the server.
In addition, I get a status code of 0 (no error) from the put_packet function, even if the server does not receive it.

Can you help me identify the issue?

Thanks in advance

Godot version 3.2.3 stable
in Engine by (21 points)

1 Answer

0 votes
Best answer

Found out that _client.get_peer(1).set_write_mode(WebSocketPeer.WRITE_MODE_TEXT) is not enough to send packets as Strings and the server kept receiving array of bytes instead of strings, thus ignoring the packets.

by (21 points)
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.