Git Product home page Git Product logo

textediting-test-js's Introduction

Description

Demo/test of parallel text editing in different browser windows.
WebSockets are used to setup connection between clients and server.
WebWorker is used to not freeze main thread while computing and sending text diff.
SharedArrayBuffer is used to share memory(text) between threads. This demo is not a good example of using shared buffer, cause we still need to copy text to shared array. It is more suitable for sharing data netween more than 2 threads.

Project setup

Run './scripts/setup-project-dependencies.sh' script.

MongoDB should be installed globally

Build and run web application

Run './scripts/run-dev.sh'

Open http://localhost:3000/chat in browser

There is a tricky issue with this script - it builds(runs) different components in separate processes, proper termination was not setup, so MongoDB is not closed after script execution was stopped. In case you have an error connected to MongoDB - just rerun the script.

Debug server application

Run: './scripts/prepare.sh'

Open Project in VS Code(haven't tried other IDE) with following configuration:

// .vscode/launch.json
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceFolder}/packages/server/src/index.ts",
      "outFiles": [
        "${workspaceFolder}/packages/server/dist/**/*.js"
      ]
    }
  ]
}

// .vscode/settings.json
{
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  }
}

Known issues

  1. Application was not intensively tested because of lack of time, however should work properly enough as for a test task.
  2. Error handling does not cover all situations.
  3. Haven't tested components' deploy and production build.
  4. Application config should be extracted to a config file and/or encironment variables.
  5. Project configuration should be adjusted:
  • Live reload was broken after last project structure changes
  • Workarounds in debugging process should be fixed.

textediting-test-js's People

Contributors

vrudkovskiy avatar

Watchers

 avatar  avatar

Forkers

rylai-zihang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.