Protobuf: WebAssembly module for protobuf encoding / decoding

Created on 3 Oct 2017  路  6Comments  路  Source: protocolbuffers/protobuf

Are there any plans on wasm implementation of protobufs?

P3 enhancement javascript

Most helpful comment

No plan yet. But will investigate.

All 6 comments

There's no such plan yet. Would simply use the C++ code work for wasm, or it is more about bridging the parsing/serialization with the native JS message types?

Yes, I mean bridging with JS

No plan yet. But will investigate.

Ideally, we could get a WASM module generated directly out of the definitions in a .proto file, with exported functions to unmarshall a Uint8Array containing a PB message into a JS object, or pass in a JS object to be marshalled into a Uint8Array.

@dchenk How to create JS objects in web assembly? Is that efficient or possible? I have looked a bit into web assembly recently but I don't remember seeing any C API that can be used to construct JS objects directly in web assembly. If every manipulation of a JS object requires crossing the wasm-js boundary, creating JS objects this way in web assembly can be very inefficient.

WebAssembly doesn't have any structures besides number types. It has proposal for anyref though.

Was this page helpful?
0 / 5 - 0 ratings