Replies: 2 comments 1 reply
-
I believe that code-server on your EC2 instance is first saving the files as localStorage and then uploading it. Now if your friend were to edit the same file you are editing, the files would have two versions which don't coincide with each other, hence the request to overwrite. You could rather use Duckly and Git for version control too. That way, pair programming with version control is available and can be used. |
Beta Was this translation helpful? Give feedback.
-
Yeah code-server has no support for merging concurrent edits to the same file so whoever saved first would end up "winning" and the other person would have to either overwrite or manually compare the changes. Like @im-coder-lg mentioned a third-party tool like Duckly could work. As for the disconnects, we will need to see logs to figure those out. Multiple tabs opened to the same URL should work, although this is not an explicitly supported use case. There is an open issue for multi-user support (#33) but I do not see it being implemented any time soon and I am not sure code-server is the right place to implement it anyway. |
Beta Was this translation helpful? Give feedback.
-
My goal is to create a multi-file collaborative code-editor where multiple people from anywhere on the internet can join and edit the same file or project simultaneously with real-time updates in the browser itself.
My approach
After installing code-server (using this) for my laptop running ubuntu 22.04.2 LTS, I found out that if I run code-server to open vscode in the browser on port 8080. I can then copy the same url (i.e http://127.0.0.1:8080/) and paste it in some other browser like firefox or open in incognito, then I have these two tabs running vscode in the browser. After changing the autosave settings to afterdelay with a 10 ms gap, I can make changes in any file and those changes are reflected in other tabs as well in real-time. So my requirement of creating a collaborative code-editor is fulfilled.
Now, I want to do the same by hosting a code-server in my ec2 instance where multiple people from the internet can join and code-collab in the browser itself since any change made to any file is reflected on other tabs in real-time using auto-save. However, this is not working like it did in my local machine.
Problems faced
code-server crashes when two or more tabs are opened with the same url. When one tab is opened it works fine, but when another tab is opened it disconnects and asks for reload until only one tab is open, nothing more.
When I used ngrok to open the same localhost port on my friends laptop, any change I make in any file is reflected to him as well but as soon as we start making change to the same file at the same time, one of us gets an error message stating file changes not saved compare or overwrite? So basically we can only make changes one at a time but that change is shown on every connected machine instantly.
On AWS, I’m running an ec2 instance (ubuntu platform) where I have installed code-server (using this) and nginx setup (using this).
Any help or suggestions will be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions