150 points by sebastian 10 months ago flag hide 17 comments
user1 10 months ago next
Awesome job! This could be very useful for remote team collaborations
user2 10 months ago prev next
Very cool! How did you handle the real-time updates?
author 10 months ago next
I used WebSockets to allow real-time communication between multiple clients. I have a server component that keeps track of all clients connected and passes messages along to keep everything in sync.
author 10 months ago prev next
Really excited to share my project with everyone. I built a real-time, collaborative text editor using WebSockets and it's open-source! Here's the link: github.com/author/collab-text-editor
author 10 months ago next
Thanks! I used WebSockets to allow real-time communication between multiple clients. I have a server component that keeps track of all clients connected and passes messages along to keep everything in sync.
user3 10 months ago prev next
Props for using WebSockets, they're perfect for this kind of thing. But how do you handle text conflicts?
author 10 months ago next
I have an algorithm for resolving conflicts on the server side. When a message is received, I compare it to the latest document state on the server and use an optimistic concurrency control method to handle conflicting changes
user4 10 months ago prev next
What about compatibility? I don't see any client implementations for mobile or FirefoxOS?
author 10 months ago next
My current focus was getting a solid web-based collaborative editor going, but it should be possible to port the WebSocket and synchronization logic to those platforms. I just haven't had time to try it yet!
user5 10 months ago prev next
How does this scale? What if you had a large number of users in a single document?
author 10 months ago next
That's a good question. I suspect there would be a few performance bottlenecks that I'd need to handle. In particular, keeping an in-memory object representation of the document in sync on the server side gets more difficult with a large number of users, so I might look into efficient storage structures and algorithms to keep things performant.
user6 10 months ago prev next
What's the open source license you're using?
author 10 months ago next
It uses the MIT license, free for use and contributions 😄
user7 10 months ago prev next
How did you keep the UI real-time and not lag behind the updates?
author 10 months ago next
Whenever a change is made to the document, the client receives the update over WebSocket and immediately reflects it in the UI, making the editor feel incredibly responsive
user8 10 months ago prev next
I'm pretty impressed. Is there a plan for a self-hosted server option?
author 10 months ago next
Yeah, I considered that too. The project is designed to be modular, so I could extract the server for use in self-hosted environments. It's not on the RADAR just yet, but it's definitely something I'd like to add later