Closed 7flash closed 7 months ago
I suppose you are using C as the backend. Try using webui_send_raw()
in the backend, and this has no TextEncoder()
, which may solve your issue.
Backend:
webui_send_raw(myWindow, "myJavascriptFunction", myBuffer, 1024); // 1024 is myBuffer len
Frontend:
myJavascriptFunction(myData) {
// myData is Uint8Arra...
}
Sorry. I just noticed that you want it the other way... so to send big data to the backend and avoid TextEncoder
, make your data as Uint8Array
instead of a string object. More details here:
https://github.com/webui-dev/webui/blob/main/examples/C/call_c_from_js/main.c
Look at const big_arr = new Uint8Array(arr_size);
.
Wait, you are right... const arr_size = 250 * 1000;
gives:
Thank you @7flash @AlbertShown for reporting. This will be fixed very soon in v2.4.1.
This error appear in browser when trying to send heavy response to backend in result of script callback
Particularly it happens in this.#ws.onmessage handler
Here TextEncoder().encode(FunReturn) fails because of some in browser CPU limits
Which can be possible solutions to this issue? Notice, it works when response is small but fails when its around 250kb