Frameworks
React Native
Flutter
Version 10
Version 9
Version 8
Version 7
Version 6
Version 5
Support for realtime collaboration is included with the SDK, including demonstration implementations for using WebViewer Server and Firebase as a central server. You may consult these implementations in the Collaboration Sample as reference implementations (found in the .dmg download at /Samples/Other/Collaboration/Collaboration/
, TRNWebViewerServerService.m
and TRNFirebaseCommunicationService.m
).
This guide will demonstrate how to add support for a new realtime collaboration server in an iOS app.
In realtime collaboration, the role of the server is to:
If your server is capable of the above, it can serve as the back-end to Apryse's realtime collaboration.
This guide will explain how to configure an iOS app to interface with a server that fulfils the above requirements.
To add support for a new server backend, you need to implement a single class, referred to here as the Collaboration Service. The purpose of the Collaboration Service object is to mediate between the server and the Apryse SDK. The Collaboration Service translates messages received from the server in its data format (for example json data) into to a format that the SDK understands (specifically a PTCollaborationAnnotation
), and vice versa.
A Collaboration Service must implement the PTCollaborationServerCommunication
protocol. The purpose of each API defined in the protocol will be described in the sections below.
The Collaboration Service implements 3 methods defined in PTCollaborationServerCommunication
in order to process changes made on the device:
Each of these methods is called by the PTCollaborationManager
to communicate when a change has occurred on the device. They pass an object of type PTCollaborationAnnotation
, which the collaboration service must then convert to a format appropriate for the server, and sends it to the server.
Here is a theoretical example:
Likewise, the collaboration service is responsible for receiving updates from the server and communicating them to the Collaboration Manager, referenced in its PTCollaborationManager
property.
This is done by calling the following Collaboration Manager methods:
As in the localAnnotationAdded/Modified/Removed
methods described in the previous section, these methods take a PTCollaborationAnnotation
parameter. It is the job of the collaboration service to receive a server message, translate it into a PTCollaborationAnnotation
object, and call the appropriate method.
Here is a theoretical example:
PTCollaborationServerCommunication
, which a Collaboration Service must conform to, defines three other required APIs:collaborationManager
. This should be assigned to the instance of the PTCollaborationManager
that exists on a PTToolManager
. This is done automatically if using a PTCollaborationDocumentViewController
, described below.-(void)documentLoaded
. This method is intended to be called when a document is first loaded, and so when invoked the service should send all of the document's annotations to the collaborationManager
's remoteAnnotationAdded:
method.(NSString*)userID
, which returns the server's unique ID associated with the user. This can be used by the local viewer to restrict which annotations a user can edit.PTCollaborationDocumentViewController
, which inherits from the standard PTDocumentController
, that implements two useful functions for collaboration:PTCollaborationServerCommunication
object, and automatically connects it with its PTCollaborationManager
.PTCollaborationServerCommunication
protocol does not have any opinion on where/how server login is performed.Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales