Comments (12)
Hey @canadaduane , I'm currently updating y-redis and y-leveldb. I'll also restructure the API that adds persistence to y-websocket. Until now, I expected people to clone the y-websocket server, but I think it makes sense to at least allow users to share persistence modules properly.
from y-websocket.
Any new info about persisting state? I'd prefer pushing and pulling the persisting state to/from Postgres database so any pointers about that would be great.
from y-websocket.
Hi @rebolyte
No update.
In the limited time I have for this project (very little funding), I'm working on the new Yjs documentation site.
y-leveldb is stable now and could also be used over the different databases that levelup supports.
from y-websocket.
@dmonad The sample project has :
// Super hacky way to provide a initial value from the client, if
// you plan to use y-websocket in prod you probably should provide the
// initial state from the server.
but I can't find docs and/or figure out how to send the state up on the initial connection.
I've got this far:
utils.setPersistence({
bindState: async (docName, yDoc) => {
log.debug('bindState:', docName);
//load from db and seed?
const document = yDoc.getArray();
console.log(document.toJSON());
document.insert(0, [{ type: 'paragraph', children: [{ text: 'Hello world from server!' }] }]);
console.log(document.toJSON());
yDoc.on('update', update => {
//do some crazy saving here.
const doc = utils.getYDoc(docName).getArray('content').toJSON();
log.debug(docName);
log.debug(JSON.stringify(doc, null, 2));
});
},
writeState: async (docName, yDoc) => {
log.debug('writeState:', docName);
//this fires on connection close
}
});
and document
has the initial state, but I just for the life of me can't figure out how to push that to the front end.
from y-websocket.
Just wanted to chime in and say that we’re working on a wrapper on top of y-websocket, y-redis, and y-leveldb (in collaboration with Kevin) called hocuspocus. If you struggle to put together all the building blocks, it’s probably worth a look.
It’s only available for GitHub sponsors for now, but we’ll publish it as a MIT-licensed package in the next months. If you can’t afford sponsoring our efforts, reach out to [email protected] and I’ll invite you manually.
from y-websocket.
That would be fantastic! Thank you.
from y-websocket.
Hey @dmonad , any luck on this front? Would love to implement persistence in Yjs 13!
from y-websocket.
@renieravin Sure, I'd love to get a contribution on y-leveldb.
If you want to get started, it would be best to start a new project based on y-indexeddb and rewrite it based on leveldb. I recommend to use [leveldown]https://github.com/Level/leveldown) unless there is a good alternative.
from y-websocket.
Actually, @renieravin I just might have found a sponsor for the leveldb adapter. I'll let you know if it works out :)
from y-websocket.
@dmonad was any update made on this persistence feature? The README does talk about:
PORT=1234 YPERSISTENCE=./dbDir node ./node_modules/y-websocket/bin/server.js
So is this available for use, or a WIP?
from y-websocket.
@mikkorantalainen, you might be able to rig up a connection to Postgres by leveraging y-leveldb + level + SQLdown, though I'd be careful with SQLdown, as it looks pretty old and opinionated. You might use SQLdown as inspiration for fulfilling the level interface in a way that best suits your application's needs. Haven't tried level + SQLdown myself yet, but probably will pretty soon. Will report back if so.
from y-websocket.
Any update here? Being able to drop in y-redis here would be 🔥
from y-websocket.
Related Issues (20)
- Callback object content is empty
- Could not find a declaration file for module 'y-websocket' HOT 3
- Offline modus or pending connect
- Extraneous updates where origin == null when using full reload
- how to detect the server side ping message
- Websocket closes on tab minify/switch after +/- 30s. How to handle?
- Server-side reloaded ydoc version is getting overwritten by client-side version upon page refresh
- Missing doc data binding when refreshing the page
- the new heap suddenly increase HOT 3
- how can I stop y-websocket-server? HOT 1
- Version 1.5.2 breaks y-websocket in the browser HOT 4
- Can't get text data on server HOT 6
- WebSocket connection to 'wss://localhost:9999/' failed HOT 1
- Persistance directory HOT 1
- "type":"module" / SyntaxError: Cannot use import statement outside a module
- cannot connect to y-websocket with node HOT 1
- yrb-actioncable sync awareness
- In bin/utils.js, closeConn(..) doesn't handle correctly if persistence is null HOT 1
- npx y-websocket does not work HOT 1
- How to verify permissions in websocket
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from y-websocket.