Cysharp / MemoryPack

Zero encoding extreme performance binary serializer for C# and Unity.
MIT License
3.25k stars 190 forks source link

Platform implement #301

Closed PhuNguyen182 closed 2 months ago

PhuNguyen182 commented 3 months ago

Can MemoryPack work well on mobile platforms such as Android, iOS, or WebGL platform?

danfma commented 2 months ago

We use this communication method in a game to connect our clients and servers. We have a Unity client for Android, iOS, and WebGL connected via WebSockets. Additionally, we have a Blazor WebGL app that communicates using the same shared library used by Unity with our .NET server.

We have added the MemoryPack formatter support for our endpoints, so all serialization is performed using JSON or the memory pack, which works pretty well.

It's important to note that the payload may not always be smaller than JSON + compression (GZIP, Brotli, etc). However, if your server can generate the serialized data with minimal resources and the payload is small enough (the case when using MemoryPack), it's a good trade-off. Also, you can enable compression, but in our case, it wasn't necessary.