-
Notifications
You must be signed in to change notification settings - Fork 149
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
Use sqlite3 in web worker doesn't work #34
Comments
Hi, currently we do not support Perhaps you could move the SQLite-access functions to the main thread, and postMessage from within the worker to access it? |
so you mean pass this: var db, to the worker? |
I mean something like: var Worker = require('webworker-threads').Worker;
var sqlite3 = require('sqlite3').verbose();
var worker = new Worker(function(){
this.postMessage(...) // query to db
this.onmessage = function(event) {
// ...handler result from SQLite3...
};
});
var db = new sqlite3.Database('MyDB.db');
worker.onmessage = function (event) {
// ... do something with db ...
} Basically doing all DB filesystem operations in the main threads, and have the worker do CPU-intensive work. Something like https://github.com/mozilla/jschannel might be useful to make |
hi,
i'm trying to access to a sqlite3 db inside the web worker, i use this sqlite3 library:
https://github.com/mapbox/node-sqlite3
this is what i do:
this is the result:
and then block, how i can solve the problem? i do something wrong?
The text was updated successfully, but these errors were encountered: