Changeset - cc371473ada1
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-30 02:37:49
drewp@bigasterisk.com
logging
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/web/RdfDbChannel.ts
Show inline comments
 
@@ -92,49 +92,49 @@ export class RdfDbChannel {
 
    if (msg === "PONG") {
 
      this.onPong();
 
      return;
 
    }
 
    this.onJson(msg);
 
  }
 

	
 
  private onPong() {
 
    if (this.pinger) {
 
      this.pinger.pong();
 
      this.updateStatus();
 
    }
 
  }
 

	
 
  private onJson(msg: string) {
 
    const input = JSON.parse(msg);
 
    if (input.connectedAs) {
 
      this.connectionId = input.connectedAs;
 
    } else {
 
      this.onPatch(input as SyncgraphPatchMessage);
 
    }
 
  }
 

	
 
  private onPatch(input: SyncgraphPatchMessage) {
 
    log("patch from server [0]");
 
    log(`patch msg from server`);
 
    this.serverMessage.emit({ evType: "patch", body: input });
 
    this.messagesReceived++;
 
    this.updateStatus();
 
  }
 

	
 
  private onWsError(e: Event) {
 
    log("ws error", e);
 
    this.disconnect();
 
    this.updateStatus();
 
  }
 

	
 
  private onWsClose(ev: CloseEvent) {
 
    log("ws close");
 
    this.updateStatus();
 
    if (this.reconnectTimer !== undefined) {
 
      clearTimeout(this.reconnectTimer);
 
    }
 
    this.reconnectTimer = setTimeout(this.openConnection.bind(this), 1000);
 
  }
 

	
 
  private updateStatus() {
 
    const conn = (() => {
 
      if (this.ws === undefined) {
 
        return "no";
0 comments (0 inline, 0 general)