How to send message from server to client? #59
-
I'm migrating my game from P2P to THNK Rooms (Relay). I need to tell the player the data (stats and their player number), but I cannot figure out how to tell the client this. Is there not a way to do this, or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As explained in the docs, the way communication between server and client works is that clients send messages to the server, the server ingests messages, and responds to all clients with new server state. You can use a State variable to send any arbitrary data back to your clients. Since stats and player numbers are player specific, you'll want to use a PlayerState variable for that state to be only sent to the players it concerns.. |
Beta Was this translation helpful? Give feedback.
As explained in the docs, the way communication between server and client works is that clients send messages to the server, the server ingests messages, and responds to all clients with new server state.
You can use a State variable to send any arbitrary data back to your clients. Since stats and player numbers are player specific, you'll want to use a PlayerState variable for that state to be only sent to the players it concerns..