How to share memory between two WebAssembly instances in different workers?

Viewed 127

I want to get access to shared memory from two WASM instances, created from same module, but within different workers (main and spawned). All my attempts to share memory have failed. Even if i flag memory object as "shared", instance.exports.memory.buffer is not SharedArrayBuffer, but regular ArrayBuffer. I know that data is being modified in main worker, but there are no changes in spawned worker. Can someone explain how to share the memory right way?

0 Answers
Related