MsgPack for JS cloud scripts

Hi!

Is there a way to add MsgPack to Cloud Code (JS) scripts?
This will help with payload size, request speed and it will make the response/request paylod little bit harder to read.

If not, this will be something nice to have. Maybe not MsgPack, but something similar

I know we can use this package with cloud code modules but the c# modules system is still at the beggining and pretty hard to use.

Thank you!

2 Likes

Hello there,

If you use the Unity Editor to deploy the JS scripts, you can bundle MsgPack in like this:

import { encode, decode } from './msgpack'

The second step is necessary because the Cloud Code runtime doesn't support TextEncoder, which is necessary for MsgPack.

For more details on how to deploy with the Unity Editor, check out this page: https://docs.unity.com/cloud-code/manual/scripts/authoring-scripts-editor

2 Likes

Thank you for the reply.

We'll check both JS+your solution above (which gave us a lot of other ideas :smile: ... thank you again) and C# modules implementations and see which one is a better approach for our project.

1 Like

A small bump that the URL has moved here: https://docs.unity.com/cloud-code/en/manual/scripts/how-to-guides/write-scripts/deployment-window

1 Like