diff --git a/src/ot/client.ts b/src/ot/client.ts index ef03979..7978575 100644 --- a/src/ot/client.ts +++ b/src/ot/client.ts @@ -1,5 +1,5 @@ // 客户端实现 -import { SimpleTextOperation as TextOperation } from "./op"; +import { Noop, SimpleTextOperation as TextOperation } from "./op"; import { getDemoServerInstance } from "./server"; // 直接获取server实例,这里省略了网络过程 @@ -94,7 +94,7 @@ export class Client { this.enableSync = enabled; // 重新启用同步,继续发送本地操作,发送一个空操作,确保服务端向我们推送最新操作 if (enabled) { - // this.buffer.push(new Noop()); + this.buffer.push(new Noop()); this.sendOperationIfNeed(); } } diff --git a/src/ot/server.ts b/src/ot/server.ts index 300e8e1..9576ba2 100644 --- a/src/ot/server.ts +++ b/src/ot/server.ts @@ -17,7 +17,7 @@ class Server { // 每当从客户端接收到操作时调用此方法 receiveOperation(client: Client, revision: number, operation: TextOperation) { - console.log("server", "received operation", revision, operation); + console.log("server", "received operation from", client.name, revision, operation); if (revision < 0 || this.operations.length < revision) { throw new Error("operation revision not in history");