FoxitPDFSDKforWeb v10.0.0
Foxit PDF SDK for Web
|
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...
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... | |
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.
Promise<boolean> CollaborationCommunicator::connect | ( | shareId:string | ) |
Connect to the collabroation server with a specified shareId.
shareId | string - |
Implemented in WebSocketCommunicator.
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.
doc | PDFDoc - ViewerPDF.PDFDoc |
void CollaborationCommunicator::destroy | ( | ) |
destroy the communicator.
Promise<boolean> CollaborationCommunicator::disconnect | ( | ) |
Disconnect the collaboration communicator from server.
Implemented in WebSocketCommunicator.
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.
shareId | string - |
fromVersion | number - |
Implemented in WebSocketCommunicator.
Promise<CollaborationSessionInfo | undefined> CollaborationCommunicator::getSessionInfo | ( | shareId:string | ) |
Obtains current session info by share id.
shareId | string - Target share id |
Implemented in WebSocketCommunicator.
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.
Implemented in WebSocketCommunicator.
void CollaborationCommunicator::registerLostConnectionListener | ( | callback:() | , |
void | |||
) |
register a callback that used to receive and sync data from server. This method will be called only once.
receiver | ()=>void - |
void CollaborationCommunicator::registerMessageReceiver | ( | receiver:(data:string) | , |
void | |||
) |
register a callback that used receive message from server . This method will be called only once.
receiver | (data:string)=>void |
Promise<void> CollaborationCommunicator::send | ( | shareId:string | , |
data:string | |||
) |
Sends the collaboration data to server, and then transmit the data to other clients.
shareId | string - current session id. |
data | string - collabroation data(a valid JSON format) |
Implemented in WebSocketCommunicator.