Web-sys - how to send plain JSON over postMessage?


so it seems that the stdweb crate is broken and I'm trying to re-write my code using web-sys only.

The question that I have now, in the provious version of my code I was just using a stdweb js!() macro to send some JSON data using the postMessage method of my audioWorklet.

stdweb version:

postMessage( { source_type: @{ next_source_type }, timestamp: @{ trigger_time }, sample_id: @{ next_event }, params: @{ next_params }} );

So what would be the easiest way to send plain, anonymous JSON data using web-sys ? There isn't that many examples, and I don't want to create data structures for every message I send ...


Any hints ?


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.