-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Web Workers to run CPU Intensive queries #462
Comments
I'm not sure what you mean. You have to download the files mentioned in the instruction, and serve them from your web server. You can download the latest version here: https://github.com/sql-js/sql.js/releases/tag/v1.5.0
If you want to use the normal sql.js api, you should create your own web worker, require sql.js from it, and define your own communication protocol between your worker and your main thread. Then you let whatever packer you are using in your project create the web worker js file that will contain both your code and the sql.js dependency. |
For discussion about web workers and sql.js, see #377 |
Yeah, it worked. But,
Is this behavior expected? |
We are requesting more than 250 million rows, and then our page is getting page unresponsive.
So we decided to use web workers. We faced few problems while using web workers.
We tried in this method, but here
dist/worker.sql-wasm.js
anddist/worker.sql-wasm.wasm
resulted in page not found, hence we copy-pasted the code fromnode_modules
.From this line we got an error
var worker = new Worker("./worker.sql-wasm.js");
Uncaught SyntaxError: Unexpected token '.'
.So we used blob URL as shown below
sqlWorkers.js
worker.sql-wasm.js
This method didn't give any error, but the
Database opened
string is not logged in worker.onmessage.Can you help us with how to use web workers in sql.js.
TIA
The text was updated successfully, but these errors were encountered: