Skip to content

Conversation

simolus3
Copy link
Contributor

This adds the exposeEndpoint() method on the web, which returns a record of values that can be sent across workers on the web. It also adds a new method that takes this sent record to open another database connection to the same source, which then shares the existing connection and mutex.

This is useful to allow a worker to connect to a database already opened by a client, such as for the sync worker in the Powersync SDK. A remaining issue is related to lifetimes: When the original connection closes and disposes the worker, the exposed endpoint will also close. sqlite3_web internally uses web locks to detect this condition, but it's not yet exposed in this package.

@simolus3 simolus3 force-pushed the expose-worker-connection branch from 83c0e05 to aedd45b Compare October 27, 2024 17:44
@mugikhan
Copy link
Contributor

mugikhan commented Oct 28, 2024

@simolus3 Thanks for this. You don't have to do the versioning and changelog in this PR, we will update and release it once the changes are merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants