Starting Session

There is no distinction between starting a new session or joining an existing session from the service's point of view. The Codox client-side library will handle the bootstrapping logic for both cases transparently.

Auto start/join

When init(config)is called without specifying a value for autoStart , or if the value ofautoStartis set totrue,then the Codox client will immediately start a new session if one doesn't exist, or join an existing session if one already exists.

Example:

const editor = new Quill("#editor"); 
const codox = new Codox();

const config = {
  "app"      : "quilljs",
  "editor"   : editor,
  "docId"    : "document_1",  
  "username" : "Joe Smith", 
  "apiKey"   : "8a97c7db-5155-4245-9f9d-16e3dfd11ef2", //replace with your own
  "autoStart" : true, //the same as not specifying autoStart
};

//start co-editing immediately 
codox.init(config); 

Delayed start/join

If the autoStartfield is set to false, then the Codox client will be initialized, but the session starting/joining process will be delayed till an explicit call to codox.start().

codox.start(config)

Calling start will explicitly start or join a co-editing session. The config parameter is optional. If init(config) has already been invoked, calling start() will start/join the session based on the existing config values.

Example:

function init(){
  const editor = new Quill("#editor"); 
  const codox = new Codox();
  
  const config = {
    "app"      : "quilljs",
    "editor"   : editor,
    "docId"    : "document_1",  
    "username" : "Joe Smith", 
    "apiKey"   : "8a97c7db-5155-4245-9f9d-16e3dfd11ef2", //replace with your
    "autoStart" : false, //set to false to delay start/join
  };
  
  //initialization only
  codox.init(config);
  return codox;
}

const codox = init();

codox.start(); 

Last updated