Hello,
I’m using broadcastMessage
in the matchJoin
handler to provide the full match state to newly joining presences and a separate broadcastMessage
(first) to send a bolstered version of presences to all players (so, without the 3rd parameter). The odd thing is both of them seem to be sending the message to all presences regardless of what I provide specify for the 3rd param. Is it because the entries in presences
param are not technically part of the match yet when the message is sent, and therefore it sends to everyone?
- Versions: Nakama
3.22.0
, Docker, TS/JS client lib2.8.0
- Server Framework Runtime language: TS/JS
// inside matchJoin handler
// Broadcast presence updates to all players
dispatcher.broadcastMessage(
BroadcastOpCodes.Players,
JSON.stringify(matchState.players),
);
// Broadcast full state to newly joined players
dispatcher.broadcastMessage(
BroadcastOpCodes.FullState,
JSON.stringify(matchState),
presences,
);
In this case all participants are receiving both messages.
Any help with this would be appreciated. Thank you.