Real-Time Collaboration on a Note - Project

Ok that makes sense. If this server really is necessary, I think your best option is to create a separate one so that it can be installed and managed separately from Joplin Server.

1 Like

I'm actually not convinced that a server is needed and if it is, it should be separate from the Joplin server.

Consider this - to initiate a shared editing session you probably won't just press a button and expect the other person to accept; instead you will most likely agree on specific time and so you might as well send them a direct link to connect to your Joplin via some other channel, e.g. email or whatsapp. In this scenario a server is not needed thus reducing the scope, which I think it very important for this project as it's already huge.

Now, if we are going to have a server maybe it should be part of Joplin server to fully leverage its sharing functions. Suppose you and I are editing a document together and you insert a picture, I am going to see just the id which isn't very helpful.
With the Joplin server it can be shared automatically so that we both can see the picture.
This may be out of scope for GSoC but it's something to consider.

Btw, if we decide to have a server, we'll need an API for a plugin to show some kind of popup notification, I don't think it's possible currently?

Hi,
I read through all proposal and discussion in this matter: Trying now to summarize it, it may help in this discussion.
The technologies mentioned in the proposal and other private discussion are pretty much the same as mentioned in Joplin Server pre-release is now available - Development - Joplin Forum (joplinapp.org) and Any suggestions on what web technology could be used to add support for sharing notes? - Development - Joplin Forum (joplinapp.org).

These TECHNOLOGIES are:

  1. yjs/yjs: Shared data types for building collaborative software (github.com)
  2. Convergence: The Real-Time Collaboration Engine
  3. jsfiddle/togetherjs: A service for your website that makes it surprisingly easy to collaborate in real-time. (github.com)
  4. Socket.IO
  5. WebRTC
  6. bontaq/textdb: The whole shaboodle for textdb, a simple data sharing service (github.com)
  7. ShareDB.
  8. Gun
  9. Automerge

In addition, EXAMPLES are referenced:

  1. Use Microsoft Live Share to collaborate with Visual Studio Code
  2. An Online Visual Collaboration Platform for Teamwork | Miro and Figma: the collaborative interface design tool. to show collobartion could be visualized. I used Miro once and liked the way, the cursor of others is shown.
  3. This Is How to Build a Collaborative Text Editor Using Rails | Aha! what is a good instruction how to implement this
  4. Conclave Case Study - A private and secure real-time collaborative text editor (conclave-team.github.io) another instructions as 4. but in much more detail
  5. Textdb
  6. JSFiddle - Code Playground what uses Mozilla Labs : TogetherJS
  7. Synchronization · zadam/trilium Wiki (github.com) as it mentions Conflict resolution, what is another GSoC project, Conflict Resolution.

@Aksh-Konda, you create a new topic or put it somewhere else, whatever suits you best and do a final compare of the technologies available, similar to Convergence Labs: Choosing a real-time collaboration library.
Tell if:

  1. server is needed
  2. if so, if server can be provided as docker, e.g. Docker NodeJS Socket.io tutorial (dockerize.io)
  3. activity on the repository (project alive, issue closed within a reasonable time etc.)
  4. basic implementation into Joplin

This shall happen rather soon


If we come to the conclusion that a server is required, it shall be easily deployable.
It may be merged into the Joplin Server, if all runs stable and implementation is not much of a big deal.


For sure but I can imagine if you edit something that is deleted by someone else you are going to have a conflict that cannot be avoided.
I could imaging that in that case, the user, who changed something in the changed section, should be asked if the removal should be applied and sync of this part is frozen until this is resolved.
Anything else should happen without a conflict. The only challenge is how to keep the overview if a lot of changes are done, avoiding that your cursor jumps up and down the note etc.

4 Likes

Sure! I'm on it!

great, looking forward to the results :slight_smile:

The new topic is posted here.

1 Like

do we really need an additional web app, as that requires some development work.
Should we rather focus to have the features well integrated in the existing apps.
Check with Joplin Web - Web application companion for Joplin - #111 by foxmask on the support of plug-ins at the web-companion.

As you have done a check on the libraries.
could you describe #### Week 1 - 2 in more detail?
I would like to see milestones / interaction loops how to add feature by feature

I think the GSoC idea wanted the student to develop a web app:

Expected Outcome: A web application that allows users to collaborate on a note

However this is true.

I didn't see this, it's Great!. (accessing local Joplin notes from wherever we want...). I'll look into it.

week 1-2

  • I thought of creating similar end-points to share notes. where this end-point enables real-time collaboration on a note and which lets the web application save the changes to the note which has collaboration enabled.
  • As we have now decided to go with a P2P (WebRTC) connection instead of WebSockets, I need to create a signaling server. (which establishes a peer to peer connection)

milestone

Creating the basic backend server for the web app to use.

1 Like

forgot that it is properly a leftover of GSoC 2020 but there was not a plug-in system implemented at that time, so things a bit different now

have a talk with Laurent and Foxmask about it. It is going to be written in Phyton, so I cannot say how things can be reused.
As the magic of your plug-in happening in the background there might be good chance that it could be also being used in the web companion.

@laurent, do you regard this schedule reasonable?

That seems reasonable. @Aksh-Konda, do you think you can get a first PoC within 5-6 weeks? Something that doesn't have all the functionalities but that shows roughly how it works. Then you can improve and complete this initial version over the following weeks.

This part I would be worried about actually. 2 weeks to iron things out is not really sufficient. Instead you should consider a more iterative approach - release a simplified version, test it, debug it. Then release this improved version, and test it, debug it, based on user feedback, etc. Essentially instead of blocking 2 weeks for testing and debugging at the end, you allocate a few days here and there over the complete duration of GSoC.

Do you think you could review your schedule based on this?

The goal of Foxmask's web app is very different from what @Aksh-Konda will be doing. One is a complete online note taking application, while what Aksh's app is simply an editor. I think Aksh-Konda current approach is correct and that we cannot re-use existing code for this.

I will need some guidance over the codebase structure of the app from my mentors. Apart from that, I think I can develop the PoC within 5-6 weeks

yes, I will.

I was about to ask for some clarification on the topic, Thank you.

Hey, @Aksh-Konda this looks like a really daunting task if you want to do everything from scratch, first you should decide what method you would be using for having persistence of data for both the users while they are collaborating.
The two methods are:-

  1. Conflict-free replicated data type (CRDT's)
  2. Operation Transformation
    Then you should go ahead with choosing the library accordingly.

TLDR;

"CRDT is the holy grail of collaboration, it's an active area of research, and the prospect of peer-to-peer editing with end-to-end encryption is an exciting one. The technology isn't ready for our needs yet, but I believe in the future some incredible products will be made possible. In the meantime TinyMCE will rely on OT for collaboration, coming later this year."

Here is an amazing article by the author of convergence analyzing different open-source libraries for the persistence of data for collaborating users.

You should also check out this video if you haven't already, it clears a lot of basics about Real-time collaboration, you should also brush up on the theory behind WEBRTC(https://www.youtube.com/watch?v=FExZvpVvYxA is a good source if you want to brush up on the theory behind it).

https://www.youtube.com/watch?v=hy0ePbpna5Y


I can help you out a bit if you go ahead with convergence, it has a prebaked API for cursor management, which could be a pain in the neck if you try to make it from scratch. The downside with convergence would be that you would need to spin an instance of its server as a docker container.

I have made a tool that is quite similar to what the project requires for collaborating for data structure problems, you can check it out.

Hmu, if you have any questions on the same.

2 Likes

Hi @rishabh.malhotra, Firstly thanks for your interest in the project.

I actually did quite a bit of research on Real-Time Collaboration, WebRTC/WebSockets, Conflict Resolution Methods, libraries built for real-time collaboration which also provides different features like conflict resolution, persistence, editor binding support, and so on.

I also put up a new post on the topic "which library to be used"

Thanks for the offer... but, it was decided to use yjs/y-webrtc for real-time collaboration and peer-to-peer communication.

I've looked into the project and it's amazing. you've done extraordinary work!

1 Like

All the best man, looking forward to see what you come up with :raised_hands:

1 Like

would be great to some benefit from each other :grinning:

2 Likes

@Aksh-Konda I am also thinking of migrating from convergence to yjs, are there any gotchas you found while implementing yjs in your application, or just follow the docs.

Firstly, I'm also new to Yjs. But I realized that it only provides a set of tools that manage the changes made to an object and also some editor binding libraries to those objects. It doesn't act according to a framework and we should find some way to build around it. So I made a separate module(which I'm still working on improving) to manage all those Yjs stuff and the react components communicate with Yjs through that module.