-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support the Web Browser. #84
Comments
IIRC, you can't use seshat in the browser because you can't do multi-threading. In the meantime, you can use radical-native |
I'm not an expert on the project but I understand that there are a couple of difficulties.
If the performance is nearly the same it may even make sense to use this mode for element-web on Electron. |
@SimonBrandner How hard do you think it would be to run single-threaded in the browser? And would it be completely performance prohibitive. |
No idea - I have no experience in the area, tbh |
I tried to build with |
You don't need fs2 without memmap and then it compiles fine to wasm. Like this:
Doesn't answer how to store the index though (except in memory) |
I just want to mention that
Not sure if there's any other prerequisites. |
@phiresky Thank you for your comments! I tried to build with your suggestion in May 29, but it failed to compile because of |
I'm not familiar with this code base either.. It's not easy I think, but it's not unsolveable.
Yeah, seshat stores the data on disk in an encrypted format: https://github.com/matrix-org/seshat/blob/master/src/index/encrypted_dir.rs . That needs to be changed somehow, either just disable it for the web-browser based version or change it up. I don't think it's very smart in any case since (I think) it has to load the whole index into RAM before being able to do anything (see this line). IMO storing unencrypted would be fine but idk what the maintainer's opinion is. I think to get it working quickly it might be easiest to disable tantivy completely for now and just use sqlite. should be good enough for most queries, though I don't know what SQLite is currently used for exactly.. Still some effort to make SQLite work, since the wa-sqlite IndexedDB VFS thing is somewhat experimental and I'm not sure how easy integrating it with rust / rusqlite would be. Would be a great advancement for browser-SQLite in any case though. In general, it might be easier to make a simplified version of the whole seshat thing directly based on IndexedDB or some JS client-side full-text search library, I'm sure there is some. I'm not actually sure why this code base seems fairly large, since the API surface should pretty much just be |
Just want to let you know that I am working on this. At first I looked into full-text search with IndexedDB, which is something I did before, but it would be limited in terms of language support, because the Intl.Segmenter API is not implemented in all browsers yet. So instead I have changed tantivy to remove threading (to remove the need for SharedArrayBuffer support and a secure context) and it can now write and serach on an in-memory index in the web browser. |
There are some experimental bindings for indexedDB over here: https://github.com/poljar/indexeddb-rs. Though the next problem you'll face is that indexedDB is async while the As for Seshat itself, it uses a writer thread as well and the storage isn't yet abstracted away. We'll likely want to rework the Rust API of Seshat to be async and convert the writer thread to an async task. |
Is your feature request related to a problem? Please describe.
element-web can't search encrypted rooms.
Describe the solution you'd like
seshat should work in the browser so that element-web can search encrypted rooms.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: