Reading the docs on the go runtime, I came across this:
func (m *Match) MatchLoop(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, messages []runtime.MatchData) interface{} {
mState, _ := state.(*MatchState)
for _, presence := range mState.presences {
logger.Info("Presence %v named %v", presence.GetUserId(), presence.GetUsername())
}
for _, message := range messages {
logger.Info("Received %v from %v", string(message.GetData()), message.GetUserId())
reliable := true
dispatcher.BroadcastMessage(1, message.GetData(), []runtime.Presence{message}, reliable)
}
return mState
}
I am not sure of what []runtime.Presence{message}
means
I am not so hot on go yet, but I read this as “create a slice of presences from this message”
Does this mean that it creates a slice with a single element with the sender of the message?
(PS: unrelated but… doesn’t BroadcastMessage have an extra sender
parameter before reliable
?)