Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    floh79
    @floh79
    @dmonad Would it be possible if I enable ssl on nginx (reverse proxy), but can y-js client handle https? We're looking forward to V13. :)
    floh79
    @floh79
    Yes, it works with SSL (Reverse Proxy with ssl enabled). Yay! :) Now I have to find out how to secure y-js with password.

    I assume you use the websockets-client connector. Here is a short tutorial on how to implement google authentification.

    Adapt y-websockets-server:

    Y({
      connector: {
        // no auth required for the server
        checkAuth: function (idToken) {
          return checkGoogleIdToken(idToken) // using the 'google-id-token-verifier' package
        }
      }
    })

    Where Do i have to put that on serverside? I have installed by following commands:

    npm install --save y-leveldb -g
    npm install -g y-websockets-server

    Do I have to checkout the source and modify it by myself?

    Kevin Jahns
    @dmonad
    Exactly, you have to checkout the source and modify the server to work with your auth mechanism.
    Damian Kaczmarek
    @Rush

    @dmonad do you have any examples of putting JSON inside y-js? I think I should just add a Map .. and as far as I can see json objects can be part of the map ...

    I was thinking of flattening objects to "a.b.c": "some_value" but maybe it's not necessary ...

    I mainly want to track individual settings changes. Most are 1 level deep ... but I don't want to exclude future settings which may be more complicated
    Kevin Jahns
    @dmonad

    You could just do ymap.set('user', { userName, base64Image }) or similarly yarray.insert(0, [{ userName, base64Image }])
    If you plan to change userName a lot - you could also do

    const user = new Y.Map()
    user.set('userName', userName)
    user.set('base64Image', 'really long string .. ')
    ymap.set('user', user)
    
    // change it
    ymap.get('user').set('userName', newName)

    This allows you to save some bandwidth because the base64Image is not overritten when you change userName

    Kevin Jahns
    @dmonad
    Update about my progress on Yjs v13, as you requested:
    questsin
    @questsin
    Hi guys... I'm new to yjs.. building a few connectors and I'd like to know if anyone has a sequence diagram that shows how the various combos of SyncAll and role accomplish. how would a peer tell the others its a master? From what I can tell all examples assign attaching peers as master via self.userJoined( p.uuid, 'master')
    Kevin Jahns
    @dmonad
    Hi @questsin If you plan to build your own connector I recommend you to start with Yjs v13 (still in beta) that I plan to release next month.
    The connector interface was pretty complicated. I dedicated a section to the v13 docs that explains how document updates work: https://github.com/y-js/yjs/blob/master/README.v13.md#document-updates
    questsin
    @questsin
    I cant reporduce the demo in version 13.. npm i y-textarea
    npm ERR! code E404
    npm ERR! 404 Not Found: y-textarea@latest
    questsin
    @questsin
    is version 13 backward compatible with 12?
    questsin
    @questsin
    Im using vue with webpack. when just importing the library I'm getting an error of
    Uncaught TypeError: Cannot read property 'name' of undefined
    for v13
    Kevin Jahns
    @dmonad

    Right, I haven't published the textarea package. v13 is still lacking good demos. You can try out the https://github.com/y-js/yjs-demos and the prosemirror demo.

    No, v13 is not backward compatible.

    I haven't tested v13 with webpack. I can't figure out like this why it doesn't work.

    questsin
    @questsin
    Ok thanks. I’ll fiddle with both. Is it still possible to build custom providers?
    Kevin Jahns
    @dmonad
    It most definitely is. The
    The provider idea is a concept to manage document updates. It is not a class you need to implement. The v13 docs above explain how document updates work
    laurieherault
    @laurieherault
    I confirm the problem with webpack. https://codesandbox.io/s/r1mqzy4oo (Thank you for this amazing library :) )
    Kevin Jahns
    @dmonad
    Thanks @laurieherault for the link and the appreciation :)
    That helped me to figure out the issue. I'll fix it in the next release
    I'll try to release tonight
    laurieherault
    @laurieherault
    Thanks !
    laurieherault
    @laurieherault
    Hello :) Any news about a correction ?
    Kevin Jahns
    @dmonad

    Thanks to @NathanaelA pledge on Patreon we just received a wonderful addition:

    :sparkles: Monaco support (the editor that powers VS Code) :sparkles:

    Live Demo: https://yjs-demos.now.sh/monaco/
    Demo Code: https://github.com/y-js/yjs-demos/tree/master/monaco
    Binding repository: https://github.com/y-js/y-monaco

    Kevin Jahns
    @dmonad
    @laurieherault The issue was fixed in lib0@0.0.5 and Yjs@13.0.0-83 (yes I'm reposting this because I accidentally deleted the message). You need to update all y-* packages to get rid of lib0@0.0.4 (which was causing the issue).
    laurieherault
    @laurieherault
    It's work, tank you :)
    calibr
    @calibr
    @dmonad conguratulations with the great refactoring! I haven't got a chance to take a closer look at the latest version of yjs yet. Has encoded structures format changed since version 13.0.0-78? I mean binary format written by writeSyncStep2 and writeUpdate. Is format that was back in 13.0.0-78 compatible with 13.0.0-84?
    Duane Johnson
    @canadaduane
    This is a very cool project, thanks for all of your work @dmonad
    Does anyone know if it's possible to compose data types? e.g. an array of maps or map of arrays? Or even a map with some values as collaborative text?
    Kevin Jahns
    @dmonad

    @calibr Yes, I broke encoding. These are my final fixes to create a stable API to Yjs https://github.com/y-js/yjs/blob/master/README.v13.md#Document-Updates

    Thanks for your feedback @canadaduane :)
    You can absolutely do that in both v13 and v12. Shared types are just data types and of course you can nest them. But it may take some time to get used to the concept of shared data types. You should just start and observe the changes as you are doing them. Here is a template to create a file system using Y.Map as the directory and Y.Text as files. This will work in Yjs version 13 (in beta):

    const yMap = doc.getMap('my-directory')
    
    const file = new Y.Text()
    yMap.set('index.js', file)
    
    new TextareaBinding(file, document.querySelector('textarea'))
    Duane Johnson
    @canadaduane
    Would this example be for file contents, or file names?
    (Just trying to wrap my head around what a "file system" means in context of CRDTs :)
    Kevin Jahns
    @dmonad
    Fair enough. Bad example. This is definitely not a real file system. But the example creates a Y.Map (similar to Map) that maps from filename to the content of the file (in this case text only).
    I hoped this was the example you were looking for.
    You can add a new file by adding a new entry to the map yMap.set('index.js', file)
    The gist is that all changes to the shared types are automatically distributed to other clients.
    Kevin Jahns
    @dmonad
    I got an announcement for @all:
    I took a month vacation from my daytime job to work on the v13 release. v13 will be released very soon. I'll be hacking and documenting Yjs for the whole month of June. You can contribute by working with me on the website, documentation, testing, additional demos, or Yjs integrations (e.g. to other editors / frameworks). In exchange I'll be available for daily group meetings and answer any questions you have. The background is that I want more people involved in the project. Ping me directly if you are interested.
    Duane Johnson
    @canadaduane
    Awesome. I'm new here, but very interested in getting things working & helping where I can.
    calibr
    @calibr
    @dmonad what are you plans on updating UndoManager for the latest yjs version? I tried to implement a custom undo manager myself, but gave up because it seems core methods like isParentOf, AbstractItem.redo need to be modified as well and probably you already have plans on them.
    Kevin Jahns
    @dmonad
    I want to rework the undo manager. I will probably take a similar approach to snapshotting, but on a per-user setting. Both are not working at the moment. I put it on my bucket list for next month #99.
    crazypenguinguy
    @crazypenguinguy
    image.png
    crazypenguinguy
    @crazypenguinguy
    @dmonad It looks like there may still be an issue with Webpack on the most recent versions (yjs@13.0.0-87, y-websocket@1.0.0-5) . I'm trying to use React with your example code from README.v13.md.
    import React, {Component} from 'react';
    import * as Y from 'yjs'
    import { WebsocketProvider } from 'y-websocket'
    const doc = Y.Doc() 
    const provider = new WebsocketProvider('http://localhost:1234', 'roomname')
    provider.sync('doc')
    const ytext = doc.getText('my resume')
    class App extends Component {
      render() {
            return (<div>test</div>);
      }
    }
    export default App;
    Kevin Jahns
    @dmonad
    Could you please publish a demo application that I can debug? This could be related to your bundler configuration. The monaco example (build with webpack) still works https://github.com/y-js/yjs-demos/blob/master/monaco/index.js
    crazypenguinguy
    @crazypenguinguy
    Kevin Jahns
    @dmonad

    Thanks @crazypenguinguy I made some mistakes i the documentation. For example the url must be a ws:// or wss:// url. I corrected it. Let me know if something else is unclear.

    Here is the fixed code for your demo:

    import React, { Component } from "react";
    import ReactDOM from "react-dom";
    import * as Y from "yjs";
    import { WebsocketProvider } from "y-websocket";
    
    const doc = new Y.Doc();
    //const doc = new Y.Doc()
    const provider = new WebsocketProvider("ws://localhost:1234", "roomname", doc);
    const ytext = doc.getText("my resume");
    
    class App extends Component {
      render() {
        return <div>test</div>;
      }
    }
    export default App;
    
    const rootElement = document.getElementById("root");
    ReactDOM.render(<App />, rootElement);
    crazypenguinguy
    @crazypenguinguy
    That worked perfectly! Thanks for the help @dmonad!
    Duane Johnson
    @canadaduane
    Is there any documentation comparing yjs and automerge/hypermerge? I'd love to be able to more intelligently compare the systems. They seem very similar on the surface. I'm seeing a (possibly?) more advanced set of demonstration apps on the hypermerge side (e.g. trellis, pixelpusher, pushpin, farm) but more speed and compact size achievements on the yjs side. Is that fair? Any other points of interest?
    Duane Johnson
    @canadaduane
    I'd also appreciate any pointers anyone has to p2p Electron apps implemented with yjs under the hood.
    Duane Johnson
    @canadaduane
    Last but not least... are there any querying engines built in or otherwise connected to yjs? For example, if I need a read-only queryable index of documents, what is the go-to solution at this time?