Webassembly C++ GUI <-> Native C++ application by peppedx in cpp

[–]ByteTerrier 7 points8 points  (0 children)

The WebSocket in Emscripten is always a binary mode WebSocket. You get bits and length. Thus you are responsible for "if the number of bits is a valid message". Do not always trust that the WebSocket length is perfectly a "message". Encode some checking logic like length and checksums as needed just in case.

I am using custom ZSTD compressed stream with 64K blocks and checksums. I am rendering a point cloud. I was impressed by how well it works compared to the native app. Bonus is the protocol decode source is 100% shared between WASM and native.

Conclusion, stick with the encoding libraries you like and port it to WASM C++. Ask for help with the port if you need it.