0 votes

I used the example almost exact same as this minimal server:

but I noticed that there is almost no available how to show to send data as server data.When there was one, it's usually written on C# which I'm not familiar with.

I write on Godot script mostly.

So, what is the command to send data as server?

I'm currently using python websocket to work with godot script. Both will use server/client. I just don't know how to send data as server using Websocket.

Keep that in mind, I'm still learning how to use websocket so please feel free to talk to me like as if I'm 5 years old lol

Godot version 3.4 3.3 3.2
in Engine by (82 points)

1 Answer

0 votes

Hi, I think your problem is maybe solved already, but for future readers.

To send data from the server you can use put_packet (PoolByteArray buffer)


or put_var (Variant var, bool full_objects)


This is the code I'm using for sending an UTF-8 string

var packet: PoolByteArray = JSON.print(message).to_utf8()
print("Sending packet ", packet.get_string_from_utf8())
by (14 points)
edited by
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.