Decoding message.data in MatchLoop throws exception

Here a results of my research:

  1. Transport serialization type (plain json or protobuf) depends on client side. You should use the Protobuf Adapter with Nakama JS SDK nakama-js/packages/nakama-js-protobuf at master · heroiclabs/nakama-js · GitHub for this.

  2. But protobuf serialization works only for nakama build-in data messages. You should serialize your data by yourself (Protobuf and REST API - #2 by novabyte) because there is no way to extend nakama build-in protobuf schemas (Decode own protocol protobuf messages in JS client - #2 by mofirouz). Easiest way is msgpack (MessagePack: It's like JSON. but fast and small.), but there is a huge owerhead because msgpack data contains field names

  3. JS SDK have issues with sending binary data itself also. Discussion and solution here - Nakama js client has problems with decoding data

  4. Typescript server framework have wrong binary array data declarations. Discussion and solution here - [TS] Fix wrong binary array data declaration · Issue #66 · heroiclabs/nakama-common · GitHub

3 and 4 will be fixed soon i hope