Godot websocket does not send packets, but returns no error

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

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

:bust_in_silhouette: Reply From: Gargarensis

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.