paullouisageneau / datachannel-wasm

C++ WebRTC Data Channels and WebSockets for WebAssembly in browsers
MIT License
148 stars 25 forks source link

About using stringToUTF8 instead of allocUTF8FromString in webrtc.js and websocket.js #23

Closed hanseuljun closed 3 years ago

hanseuljun commented 3 years ago

How do you think about using stringToUTF8 from https://emscripten.org/docs/api_reference/preamble.js.html? In case you are okay with using stringToUTF8, as it is a part of emscripten, in effort to follow the herd to receive free updates (though this function is not something that is likely to change over time), I would like to try using stringToUTF8!

paullouisageneau commented 3 years ago

Actually, allocUTF8FromString is a helper function to allocate the memory with malloc and convert the string with stringToUTF8.

hanseuljun commented 3 years ago

Oh, you are right. I'm not sure why I haven't seen that. My bad haha