Skip to content

luketchang/replit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Code Editing and Execution

A basic collaborative code editing and execution system inspired by a design described in this Replit blog post. Note that this does not use a separate proxy server and still has the container manager double as the proxy.

High Level Components

  1. Client: Allows users to connect to remote directories, trigger file edits and code execution, and runs the OT sync protocol in the background
  2. Container Manager: Manages containers and proxies client connections to containers
  3. Containers: Isolated environments that handle file OT operations and code execution, streaming back results to container manager to be proxied back to user

Example Flow

Start Connection Manager

python server/conman.py

Start/Connect Client A

python client/client.py
open:<path_to_project>/example_remote_repo

Start/Connect Client B

python client/client.py
open:<path_to_project>/example_remote_repo

Inspect File We Will Edit

cat:blastoff.lua

Client A Sends Ops to Modify blastoff.lua (adds OT1 tags)

edit:blastoff.lua:[36, "[OT1] ", 55, "[OT1] ", 83, "[OT1] ", 42, "[OT1] ", 680]

Check Client B Has Updated Ops

cat:blastoff.lua

Client B Sends Ops to Modify blastoff.lua (adds OT2 tags)

edit:blastoff.lua:[42, "[OT2] ", 61, "[OT2] ", 89, "[OT2] ", 48, "[OT2] ", 680]

Check Client A Has Updated Ops

cat:blastoff.lua

Client A or B Can Execute The Updated File

run:blastoff.lua

Start/Connect Client C

python client/client.py
open:<path_to_project>/example_remote_repo

See Client C Has Synced Files (should have OT1 and OT2 tags)

cat:blastoff.lua

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published