Send a message to a single player?
-
I understand how Colyseus allows players to receive updates to a single game state.
I want to know if there is something in Colyseus that allows me to send messages to certain players but not all of them via the state.
I am coding a trivia game with Colyseus. When a player submits an answer, I want to send the right answer to ONLY him, not all other players as well. Is this possible? Am I approaching this problem the wrong way?
Thanks
-
Hi @funkmeisterb,
You can use the
send(client, data)
method: http://colyseus.io/docs/api-room/#send-client-dataThe message will arrive in the
onData
signal in the client-side.(This signal is going to be renamed to
onMessage
on version0.9.x
, I'll write and share a guide on how to migrate once its ready!)
-
Thank you @endel for the quick reply, this is exactly what I was looking for. I should've found it in the documentation.