Collaboration implementation based on native WebSocket API. For compatibility information, please refer to this link: Can i use websocket
More...
|
| connect (shareId:string) |
| Connect to the collabroation server with a specified shareId. More...
|
|
| disconnect () |
| Disconnect the collaboration communicator from server. More...
|
|
| 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...
|
|
| getSessionInfo (shareId) |
| Obtains current session info by share id. More...
|
|
| 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...
|
|
| send (shareId:string, data:string) |
| Sends the collaboration data to server, and then transmit the data to other clients. 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...
|
|
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...
|
|
Collaboration implementation based on native WebSocket API. For compatibility information, please refer to this link: Can i use websocket
- 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
◆ connect()
WebSocketCommunicator::connect |
( |
shareId:string |
| ) |
|
|
inline |
Connect to the collabroation server with a specified shareId.
- Parameters
-
- Returns
- Promise<boolean>
Implements CollaborationCommunicator.
◆ disconnect()
WebSocketCommunicator::disconnect |
( |
| ) |
|
|
inline |
◆ getLostData()
WebSocketCommunicator::getLostData |
( |
shareId:string |
, |
|
|
fromVersion:number |
|
|
) |
| |
|
inline |
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[]>
Implements CollaborationCommunicator.
◆ getSessionInfo()
WebSocketCommunicator::getSessionInfo |
( |
shareId |
| ) |
|
|
inline |
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.
Implements CollaborationCommunicator.
◆ isConnected()
WebSocketCommunicator::isConnected |
( |
| ) |
|
|
inline |
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>
Implements CollaborationCommunicator.
◆ send()
WebSocketCommunicator::send |
( |
shareId:string |
, |
|
|
data:string |
|
|
) |
| |
|
inline |
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>
Implements CollaborationCommunicator.