16500

How would you design a Collabritive/ Shareable Text Editor: Key points are given below

Question:

Read/Write operations by multiple users. A user may be able to make the editor read only i.e only the creator of the session writes. You should be able to share the link of the current session to add more users to work on simultaneously. It should be concurrent(synchronization) and avoid editing conflicts. Suggest approach to do this. Please focus on a correct and scalable functionality. Should have auto save Editor should maintain changes/edits on each save. Support rollback to any change. Must have share/like functionality for social media.

I was able to come with the following, need help identifying classes to build a class diagram for this:

It will be a client server implementation.

For website, client can be written in HTML5 and Javascript. We can use additional javascript frameworks for specific requirements(eg. angularjs).

For sending request two methods are available: 1. Request/Response -- Sending request every second 2. Long pooling -- Make a never ending http request to server and communicate through it. This method will be way faster that earlier one because multiple http request will not be made.

Its the work of client to send the changes to server on fixed interval (1 second). Its the work of client to understand the changes done by other users and display the same to current user.

Server will be expose an API which will be used to -- Get current document -- SendUpdate request whose response will contain modification done by other users on same document. We will try and capture the delta and represent the changes on the client side.

Server Stack has to be very fast(.node.js or golang will be suitable for such requirement) because of its very short response time. Data should be stored in memory, we can use Redis to store data. We can on intervals or on explicit save requests, save data on the file system or non in memory databases also.

Every request will contain set of changes made by client. These changes will be saved in Redis along with timestamp. We wont be store whole file in database, we will just store historic changes. As redis is based on memory, it will take very little resource to compute final document from set of stored changes.

For every document there will be unique id associated with it. Unique id should be long enough. You can create a url for notepads like example.com/notepad/{unique-id} This will load the client and then load the document related to that unique id.

For every request this unique id will be send to identify which document is being edited by user. Save As every change is being sent to database, it will be auto saved.

Revert You can keep historic data in AngularJs. If you want persistence between sessions, store data to file system. You can also retrieve historic information from server using API. Which can be undone.

Facebook Share We can also use FB graph api to post link in user;s timeline or Facebook exposes a sharer.php url, which can be used to share Post / Share a link in user's timeline.

Scalability We can use cloud based scalable solutions like Mmazon AWS EC2 instances to implement this solution. We can keep webserver behind a load balancer. We have to keep redis as separate (large) ec2 instance. There can be multiple webserver behind load balanacer. All of them will be communicating with Redis instance. We can keep static data like css and js in CDN (AWS CloudFront behind S3)

Answer1:

It will be a client server implementation.<br /> Where server will be expose an API which will be used to<br /> -- Get current document<br /> -- SendUpdate request whose response will contain modification done by other users on same document

Its the work of client to send the changes to server on fixed interval (say 1 second). Its the work of client to understand the changes done by other users and display the same to current user.

For website, client can be written in HTML5 and Javascript. You can use AngularJs as javascript framework for the same.<br /> For sending request two methods are available:<br /> 1. Synchronization<br /> -- Sending request every second<br /> 2. Long pooling <br /> -- Make a never ending http request to server and communicate through it. This method will be way faster that earlier one because multiple http request will not be made.

Server Stack has to be very fast. node.js or golang will be suitable for such requirement, because of its very short response time.<br /> Data should be stored in memory, you can use Redis to store data.

Every request will contain set of changes made by client.<br /> These changes will be saved in Redis along with timestamp. <br /> You wont store whole file in database, you should just store historic changes. As redis is based on memory, it will take very little resource to compute final document from set of stored changes.

Recommend

  • What is wrong with this mysql connection string?
  • How Can I Prevent Recurring Automatic Connections to Oracle Database?
  • tomcat : How to get opened jdbc:oracle connection's stack trace?
  • angular Scroll div on button click
  • Getting webGL error in autodesk viewer
  • How to Cache Images Dynamically-Generated with PHP?
  • passing parameter to server in ExtJs
  • How to re-render views using Angular JS
  • Connection pooling with URLConnection?
  • retrieving data from url in iphone
  • 550 Access denied - Invalid HELO name
  • How can I speed up CURL tasks?
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • htaccess add www if not subdomain, if subdomain remove www
  • Content-Length header not returned from Pylons response
  • JSON response opens as a file, but I can't access it with JavaScript
  • Play WS (2.2.1): post/put large request
  • Bad request using file_get_contents for PUT request in PHP
  • Seeking advice on Jetty HttpClient Hang
  • How to access EntityManager inside Entity class in EJB3
  • Why is an OPTIONS request sent to the server?
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • swift auto completion not working in Xcode6-Beta
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Accessing IRQ description array within a module and displaying action names
  • How would I use PHP exceptions to define a redirect?
  • How to add date and time under each post in guestbook in google app engine
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • vba code to select only visible cells in specific column except heading
  • Symfony2: How to get request parameter
  • Is there a mandatory requirement to switch app.yaml?
  • Cannot Parse HTML Data Using Android / JSOUP
  • File upload with ng-file-upload throwing error
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • AngularJs get employee from factory
  • log4net write single file for each call to log.info
  • C# - Getting references of reference
  • Getting error when using KSoap library to consume .NET web services