Here a results of my research:
-
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.
-
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
-
JS SDK have issues with sending binary data itself also. Discussion and solution here - Nakama js client has problems with decoding data
-
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