Company
Date Published
Author
-
Word count
897
Language
English
Hacker News points
None

Summary

Kostas Kyrimis describes the journey of developing jsmgclient, a WASM-based JavaScript client adapter for Memgraph, highlighting the integration of Emscripten with cmake to add WASM as a compilation target for mgclient. The process involved creating JavaScript wrappers for data types and networking interfaces supported by the Memgraph's Bolt protocol, leading to the first connection with Memgraph using a WASM module. However, initial challenges arose due to the synchronous nature of the mgclient's networking stack, which conflicted with the asynchronous emulation of network system calls as WebSockets. By adapting the networking stack to be asynchronous with Emscripten functions, Kyrimis successfully ran a "Hello world" example, marking the birth of the first WASM-based Memgraph client. The project demonstrated the simplicity of implementing JavaScript wrappers by delegating calls to exported WASM functions, suggesting a potential future impact on database client libraries through language-agnostic generators using the WASI standard.