1

I am going to make a realtime text editor,

after my research, I understood that google doc is using javascript and quite hard for a non-experience student to do this kind of application.

And i found that there is another editor perform similiarly:

http://collabedit.com/

So the problem is, it this implement base on java script or using other more easier approach? I would like to do some editor like that one and i don't need any syntax check . just allow multi- users input font at real time and notify who typing the word, thats all.

1)Can i do this by ajax?

2) What function i can use to do that?

Thank you.

4
  • +1 this is not a specific question (like the one that we expect on SO) but quite interesting to find out a general approach to this requirement. I took the liberty to add the php tag to your question. Commented Mar 4, 2012 at 17:47
  • You want something more like a chat, or a 'clouds document' multi-ways editable? Commented Mar 4, 2012 at 18:16
  • yeah i just think of a chat room when i ask this question. but the chat room is the whole line and my 'editor' is a word- by word to display Commented Mar 4, 2012 at 18:27
  • I am going to sleep . see yours eight hours later. Again, Thank you for answering. Commented Mar 4, 2012 at 18:33

2 Answers 2

2

What you're describing is a bit beyond the functionality of AJAX and enters into a slightly more advanced model known as COMET (which may or may not include the facilities of WebSockets depending on who you ask).

More or less, Comet allows bi-directional communication between the web page and the server. This means the client is able to post notifications to the server and the server is able to push notifications to any of its clients. A good framework that abstracts this for you is Socket.IO.

The next thing you'll need to address is the back end. You'll need a server side application that tracks who is connected so you can collect changes (new text from each user) and post those changes to the other listeners (the other users participating in the text editing session). While you may be able to use PHP, C#, etc. to accomplish this, I would personally recommend you take some time to learn node.js as it is engineered to specifically handle this kind of realtime multi-user application.

Lastly, I have a similar answer to another post here that may help you further.

Sign up to request clarification or add additional context in comments.

2 Comments

pusher.com is this thing helpful? and i would like to understand the mechanism more specifically. e.g. when one type in , what should the server do ?
Thank you . For sure i will study it myself before asking more question .
1

For what you want to achieve, you may be better off using HTML5's new WebSockets. They use a much smaller overhead, and were made for extended, continuous connections.

http://websocket.org/quantum.html

1 Comment

@user782104 I can't say, as I only have limited experience using WebSockets. It's really up to you: hard-code it and know what does what, but risk spending more time on it than it's worth, or use a pre-made library, skip the technical mumbo-jumbo, but risk spending even more time trying to figure out how it works. If this is an in-house experiment, I would suggest the former, but if you're doing this for someone and time is of the essence, try out pusher (that way, at least you have someone to blame if it doesn't work ;) ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.