Definition in internal Nakama code:
// 3. Other combinations not including the current index.
results = append(results, groupIndexes(others, required)...)
return results
}
type Matchmaker interface {
Pause()
Resume()
Stop()
OnMatchedEntries(fn func(entries [][]*MatchmakerEntry))
Add(ctx context.Context, presences []*MatchmakerPresence, sessionID, partyId, query string, minCount, maxCount, countMultiple int, stringProperties map[string]string, numericProperties map[string]float64) (string, int64, error)
Insert(extracts []*MatchmakerExtract) error
Extract() []*MatchmakerExtract
RemoveSession(sessionID, ticket string) error
RemoveSessionAll(sessionID string) error
RemoveParty(partyID, ticket string) error
RemovePartyAll(partyID string) error
RemoveAll(node string)
Remove(tickets []string)
}
and
func (m *LocalMatchmaker) Resume() {
m.active.Store(1)
}
func (m *LocalMatchmaker) Stop() {
m.stopped.Store(true)
m.ctxCancelFn()
}
func (m *LocalMatchmaker) OnMatchedEntries(fn func(entries [][]*MatchmakerEntry)) {
m.matchedEntriesFn = fn
}
func (m *LocalMatchmaker) Process() {
startTime := time.Now()
var activeIndexCount, indexCount int
defer func() {
m.metrics.Matchmaker(float64(indexCount), float64(activeIndexCount), time.Since(startTime))
}()
Usage:
outgoing.GetMatchmakerMatched().Self = users[i]
outgoing.GetMatchmakerMatched().Ticket = entry.Ticket
// Route outgoing message.
m.router.SendToPresenceIDs(m.logger, []*PresenceID{{Node: entry.Presence.Node, SessionID: entry.Presence.SessionID}}, outgoing, true)
}
wg.Done()
}(entries)
}
wg.Wait()
if m.matchedEntriesFn != nil {
go m.matchedEntriesFn(matchedEntries)
}
}
}
func (m *LocalMatchmaker) Add(ctx context.Context, presences []*MatchmakerPresence, sessionID, partyId, query string, minCount, maxCount, countMultiple int, stringProperties map[string]string, numericProperties map[string]float64) (string, int64, error) {
// Check if the matchmaker has been stopped.
if m.stopped.Load() {
return "", 0, runtime.ErrMatchmakerNotAvailable
}
This functions seems to provide possibility to set hook to receive all matched entries AFTER matchmaking process, yet I cannot find any information in docs, github, runtime’s references or anywhere else of how to use it or a way to register this hook. Is this some unused feature to be removed or is it waiting for server runtimes implementation?