JThree
JThree

Reputation: 2506

simultaneous text editing

I'm trying to program a Webpage, which allows to edit a text document simultaneously.

To program something like a Chat in Node.js is not very difficult, but working on the same text makes it kinda tricky. I thought about sending the char position and the changes characters, but if someone types something previous to the change, the change would be placed on the wrong position.

What's the best way to exchange Modifications between my clients?

Upvotes: 2

Views: 1485

Answers (2)

soyuka
soyuka

Reputation: 9105

You should use Socket.io to have make your Real-Time application.

I just founded a nice blog article which speaks about real time edition, see here. It's also providing a link to the github project and to an open source online editor project. Take a look and try to understand how they do stuff like this, good luck !

Upvotes: 3

Four_lo
Four_lo

Reputation: 1150

Two people cannot be manipulating the same object at the same time from a different place. You basically have two choices. 1. Let them take turns with the object 2. duplicate it if they both want it, but that doesnt sound like it would end well

Upvotes: 0

Related Questions