ShareDB是一个整合了前后端的 OT 框架,可以很方便地自行搭建服务端和客户端。框架基于 Node.JS 实现。
基于官网实例:sharedb/examples/counter/,打开:http://localhost:8080/
效果:
步骤1:下载官网示例代码,地址:sharedb/examples/counter at master · share/sharedb · GitHub
步骤2:安装依赖
npm install
步骤3:编译JavaScript并启动服务
npm run build && npm start
此时的目录结构:
$ tree -L 1
.
├── client.js
├── node_modules
├── package-lock.json
├── package.json
├── server.js
└── static
参考: