Resync & reconnect issues

Hi,
I’m trying to implement convergence with Monaco editor in my anguar 9 project.

I’m facing the below erros -

  1. ERROR 20:11:43.880 A concurrency control error occurred within model “rfC9n4oCxg1gMGcnk+1aI”. Error: Invalid version of 384, expected 385.
    How do I handle above error. Is there any code I need to write to handle the above error. I get this error frequently when internet is lost and connected again.

  2. ERROR ConvergenceError: The model ‘rfC9n4oCxg1gMGcnk+1aI’ is already closing.
    How to handle the above error.

  3. Index out of bound issue

  4. convergence.esm.js:799 WebSocket connection to ‘ws://imconn.eastus.azurecontainer.io/api/realtime/convergence/default’ failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
    I have set connection timeout value to 3600 sec but again it gives timeout error in less than 2 mins

  5. Domain error / interrupted
    When I disconnect the internet and connected again then it will show the message domain is connected. Again after few secs it will show thet either domain is interrupted or domain error, can’t send message when websocket is closed.
    How do I reconnect the websocket. How to handle the code resync after connection lost.

Code :

const Convergence = require("@convergence/convergence").Convergence;

    const options = {

      connection: {

        timeout: 3600,

        handshakeTimeout: 3600

      },

      protocol: {

        defaultRequestTimeout: 3600,

        // heartbeat: {

        //   enabled: true,

        //   pingInterval: 3600,

        //   pongTimeout: 3600

        // }

      },

      reconnect: {

        autoReconnect: true,

        //reconnectIntervals: this.reconnectIntervals,

        //fallbackAuth: this.fallbackAuth

      },

      offline: {

        //modelSnapshotInterval: 100,

        storage: new IdbStorageAdapter()

      },

    };

    Convergence.connectAnonymously(

      this.globalDataService.__convergenceServerURL,

      this.globalDataService.__fullName,      

      options      

    )

      .then(d => {

        this.__domain = d;

        this.__domain.on("disconnected", (d) => {

          console.log("domain disconnected");

          console.log(d);

        });

        this.__domain.on("reconnected", (d) => {

          console.log("domain reconnected");

          console.log(d);

        });

        this.__domain.on("error", (e) => {

          console.log("domain error");

          

          console.log(e);

        });

        this.__domain.on("interrupted", (e) => {

          console.log("domain interrupted");

          console.log(e);

        });

        this.__domain.on("connected", (e) => {

          console.log("domain connected");

          console.log(e);

        });

        // Now open the model, creating it using the initial data if it does not exist.

        return this.__domain.models().openAutoCreate({

          collection: "example-monaco",

          id: "" + this.globalDataService.__sessionData.interviewCode,

          data: {

            "text": "hello"

          }

        })

      })

      .then((model) => {

        this.__model = model.elementAt("text");

        this.globalDataService.__editor.setValue(this.__model.value());

        this._initSharedData();

      })

      .catch(error => {

        console.error("Could not open model ", error);

      });