To avoid generating a code for both (rust and JS) sides, we can:
generate only a rust representation of the protocol.
create wasm module with generated code
use wasm module on JS side to decode/encode messages
In this way we can be sure: that messages on rust and JS will be encoded/decoded in the same way
Motivation
Research shows: that using different libraries/modules to generate code based on *.proto at the end can give different results. For example same message can be encoded into different bytes on JS side and on Rust side. That makes work with protocol unpredictable.
Description
To avoid generating a code for both (rust and JS) sides, we can:
In this way we can be sure: that messages on rust and JS will be encoded/decoded in the same way
Motivation
Research shows: that using different libraries/modules to generate code based on
*.proto
at the end can give different results. For example same message can be encoded into different bytes on JS side and on Rust side. That makes work with protocol unpredictable.