ReceivedMatchState not receive anything

Hi everyone,

I just want to broadcast a message from a user to others in the same match (match create and join are OK). I have two questions, hope someone can help me.

  1. I follow the instruction in ReceivedMatchState is not Receiving anything. But I got the problem (in unity):
    System.NullReferenceException: Object reference not set to an instance of an object
    at DH_RoomManagerGlobal+<>c__DisplayClass15_0.b__0 (Nakama.IMatchState newState) [0x0003e] in F:\MUZIVERSE\muziverse-city\Source_City\Assets\GameAudition\Scripts\NetworkNakama\DH_RoomManagerGlobal.cs:152
    at Nakama.Socket.ReceivedMessage (System.ArraySegment1[T] buffer) [0x001ed] in <a8a500db7f1d47f5816051b6806505a9>:0 UnityEngine.Debug:LogError (object) Nakama.Socket:ReceivedMessage (System.ArraySegment1)
    System.Delegate:DynamicInvoke (object)
    Nakama.UnitySocket/QueuedEvent:Dispatch () (at Assets/Nakama/Runtime/UnitySocket.cs:188)
    Nakama.UnitySocket:Update () (at Assets/Nakama/Runtime/UnitySocket.cs:167)

Here is my go code:
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{} {
var opCode int64 = 0
data := byte("{“some”:“data”}")
var presences runtime.Presence
var sender runtime.Presence
dispatcher.BroadcastMessage(opCode, data, presences, sender, true)
return state

  1. Look like the current way is sending a fixed opCode to clients. But I want to broadcast messages with different OptCode and data from a client to others instead. Could you help me with that, please?

Thank you very much,