Reputation: 13545
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:
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.
Upvotes: 1
Views: 3128
Reputation: 16472
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.
Upvotes: 2
Reputation: 6114
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
Upvotes: 1