In the Ninja Battle sample, the signal handler function is missing that is required by the Match handlers since 3.8.0.
I tried to patch it, by adding the code snipper from Heroic Labs Documentation | Match Handler API but I first ended up with error
TS2345: Argument of type ‘ArrayBuffer’ is not assignable to parameter of type ‘string’
in match_handler.ts
And I tried to cast the string to Array Buffer for some of the argument with JSON.parse using
new TextDecoder("utf-8").decode
. which get me through the Docker build stage but when I actually trying to spin up the image, I am seeing
nakama | {“level”:“info”,“ts”:…timestanp…,“caller”:“server/runtime_javascript.go:578”,“msg”:“Initialising JavaScript runtime provider”,“path”:“/nakama/data/modules”,“entrypoint”:“build/index.js”}
nakama | panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed [recovered]
nakama | panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed [recovered]
nakama | panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed
nakama |
nakama | goroutine 1 [running]:
nakama | github.com/dop251/goja.AssertFunction.func1.1()
at which point I declare my patch attempt fail and come here for advice.
const matchSignal = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, data: string) : { state: nkruntime.MatchState, data?: string } | null {
logger.debug('Lobby match signal received: ' + data);
return {
state,
data: "Lobby match signal received: " + data
};
}
Media: