| FoxitPDFSDKforWeb v11.1.0 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
CollaborationCommunicator Interface Reference
PDFViewCtrl » collab

An interface defines several methods that user should follow to implement custom CollaborationCommunicator. Collaboration communicator is used to process and generate collaboration sessions, synchronize collaboration data, send collaboration data, and receive collaboration data from other clients. More...

Inheritance diagram for CollaborationCommunicator:

## Public Member Functions
Promise< boolean > | connect (shareId:string)
| Connect to the collabroation server with a specified shareId. More...
Promise< string > | createSession (doc:PDFDoc)
| Create an collaboration session and returns a unique shareId. Collaboration sessions always be created when open a new PDF file and be closed after PDF file closed or the browser closed. In the server side, a session holds many client connections and collaboration data, the server should allow all clients to reuse the shareId, once all connections of the session are losted, collaboration data should be clear in the server. More...
void | destroy ()
| destroy the communicator. More...
Promise< boolean > | disconnect ()
| Disconnect the collaboration communicator from server. More...
Promise< CollaborationData[]> | getLostData (shareId:string, fromVersion:number)
| If a client is disconnected from the server for a period of time, it is very likely that the data will be out of sync. This is where the data needs to be synchronized from the server. The server should store all the data and identify it with a digital version number, which should start at 0 and add 1 for each collaborative data generated by the user. More...
Promise< CollaborationSessionInfo|undefined > | getSessionInfo (shareId:string)
| Obtains current session info by share id. More...
Promise< boolean > | isConnected ()
| detect the communicator is or not connected to server. If the communicator is lost connection. It automatically reconnects until the connection is confirmed multiple times and fails. More...
void | registerLostConnectionListener (callback:()=> void)
| register a callback that used to receive and sync data from server. This method will be called only once. More...
void | registerMessageReceiver (receiver:(data:string)=> void)
| register a callback that used receive message from server . This method will be called only once. More...
Promise< void > | send (shareId:string, data:string)
| Sends the collaboration data to server, and then transmit the data to other clients. More...

## Detailed Description

An interface defines several methods that user should follow to implement custom CollaborationCommunicator. Collaboration communicator is used to process and generate collaboration sessions, synchronize collaboration data, send collaboration data, and receive collaboration data from other clients.

Since
  7.6.0

Deprecated:
  Deprecated after version 8.5.2, Please refer to the new collaboration solution: collab-developer-guide , collab_client_api_reference and collab_server_api_reference

## Member Function Documentation

## ◆ connect()

Promise<boolean> CollaborationCommunicator::connect | ( | shareId:string |  | ) |

Connect to the collabroation server with a specified shareId.

Parameters

  shareId | string -

Returns
  Promise<boolean>

Implemented in WebSocketCommunicator.

## ◆ createSession()

Promise<string> CollaborationCommunicator::createSession | ( | doc:PDFDoc |  | ) |

Create an collaboration session and returns a unique shareId. Collaboration sessions always be created when open a new PDF file and be closed after PDF file closed or the browser closed. In the server side, a session holds many client connections and collaboration data, the server should allow all clients to reuse the shareId, once all connections of the session are losted, collaboration data should be clear in the server.

Parameters

  doc | PDFDoc - ViewerPDF.PDFDoc

Returns
  Promise<string> -

## ◆ destroy()

void CollaborationCommunicator::destroy | ( |  | ) |

destroy the communicator.

Returns
  void

## ◆ disconnect()

Promise<boolean> CollaborationCommunicator::disconnect | ( |  | ) |

Disconnect the collaboration communicator from server.

Returns
  Promise<boolean>

Implemented in WebSocketCommunicator.

## ◆ getLostData()

Promise<CollaborationData[]> CollaborationCommunicator::getLostData | ( | shareId:string | ,
|  | fromVersion:number |
| ) |  |

If a client is disconnected from the server for a period of time, it is very likely that the data will be out of sync. This is where the data needs to be synchronized from the server. The server should store all the data and identify it with a digital version number, which should start at 0 and add 1 for each collaborative data generated by the user.

Parameters

  shareId | string -
  fromVersion | number -

Returns
  Promise<CollaborationData[]>

Implemented in WebSocketCommunicator.

## ◆ getSessionInfo()

Promise<CollaborationSessionInfo | undefined> CollaborationCommunicator::getSessionInfo | ( | shareId:string |  | ) |

Obtains current session info by share id.

Parameters

  shareId | string - Target share id

Returns
  Promise<CollaborationSessionInfo | undefined> - Returns the session info inluding shareId and current openning file options.

Implemented in WebSocketCommunicator.

## ◆ isConnected()

Promise<boolean> isConnected | ( |  | ) |

detect the communicator is or not connected to server. If the communicator is lost connection. It automatically reconnects until the connection is confirmed multiple times and fails.

Returns
  Promise<boolean>

Implemented in WebSocketCommunicator.

## ◆ registerLostConnectionListener()

void CollaborationCommunicator::registerLostConnectionListener | ( | callback:() | ,
|  | void |
| ) |  |

register a callback that used to receive and sync data from server. This method will be called only once.

Parameters

  receiver | ()=>void -

Returns
  void

## ◆ registerMessageReceiver()

void CollaborationCommunicator::registerMessageReceiver | ( | receiver:(data:string) | ,
|  | void |
| ) |  |

register a callback that used receive message from server . This method will be called only once.

Parameters

  receiver | (data:string)=>void

Returns
  void

## ◆ send()

Promise<void> CollaborationCommunicator::send | ( | shareId:string | ,
|  | data:string |
| ) |  |

Sends the collaboration data to server, and then transmit the data to other clients.

Parameters

  shareId | string - current session id.
  data | string - collabroation data(a valid JSON format)

Returns
  Promise<void>

Implemented in WebSocketCommunicator.

@2026 Foxit Software Incorporated. All rights reserved.