could not encode

Error: Could not encode
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:256:13)
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:162:19)
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:246:17)
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:246:17)
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:162:19)
at _encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:246:17)
at Object.encode (/home/phantom/battlewords/matchmaking/node_modules/notepack.io/lib/encode.js:261:41)
at BattleWords.broadcastPatch (/home/phantom/battlewords/matchmaking/node_modules/colyseus/lib/Room.js:215:45)
at Timeout._patchInterval.setInterval [as _onTimeout] (/home/phantom/battlewords/matchmaking/node_modules/colyseus/lib/Room.js:93:22)
at ontimeout (timers.js:466:11)

what could happened for this error.
please help

hey @phantom007md, you're probably trying to encode a recursive or too complex structure.

I assume you're using Fossil Delta as serializer given the stack trace you've posted. Maybe you're extending EventEmitter as one of your state classes, which may cause this error.

endel your my hero and i love you. just in case ;)

in case any one else makes this mistake i was trying to mutate the client object and assign a accessToken to it so the error occurred.
i hope better errors will be shown and i didn't know that the client object cant get mutated.

i'm planning to develop lots of mobile turned based games and i'll join this fantastic framework asap