The collaboration service API provide collaboration functionality to the client application. Further, it takes care of retrieving data from the server, managing and performing business logic on this data and finally presenting it to the UI layer. This API attempts to use closures where possible.
It provides core collaboration functions for clients served by Collaboration server:
The CSCollaborationService object is obtained from the Client SDK's User object. The CSUserConfiguration object will be used to define the services that will be available to end users of your application. Each service is configured individually; its configuration is stored in a dedicated object, referenced from the CSUserConfigurationobject.
Note: More information on service configuration can be found in the article configuring the SDK.
Start by obtaining any existing service configuration and enable the service:
wcsConfig = [CSWCSConfiguration new];
wcsConfig.enabled = [node.wcsConfig.enable boolValue];
After you instantiate and set up any required configuration objects, you are now ready to create the User and then call the createUserWithConfiguration () method of your Client Instance to start all services. Then you can set delegate to the CSCollaborationService for its further usage.
To receive new collaborations you should register to Web Collaboration Service Events from the instance to collaboration service.
userObject.collaborationService.delegate = self;
Note: To do this, any class from your code should implement the following delegate from public API - SCollaborationServiceDelegate. Messages about new collaboration will come in delegate: SCollaborationServiceDelegate -> didCreateCollaboration
In this point you will have instance of new collaboration.
To be able to receive and display the sharing stream from the collaboration server you should do the following:
1) Any class from your code should implement the following delegates from public API - <CSCollaborationDelegate> and <CSContentSharingDelegate>.
2) During handling event - didCreateCollaboration in the <CSCollaborationServiceDelegate> you should register your class on Collaboration events and on the Content Sharing events
collab.delegate = self;
[[collab contentSharing] setDelegate:self];
3) You should handle the event collaborationDidStart from <CSCollaborationDelegate>. In this pint you will have the instance of the new collaboration. You should provide this in instance of the window class, which will display the contant sharing stream. Window should store the CSContentSharing instance and should register on CSContentSharing events and configure the renderingCanvas:
self.contentSharing = collab.contentSharing;
[self.contentSharing setDelegate:self];
IBOutlet CSOSXScreenSharingView *sharingView;
if (!self.contentSharing.screenSharingListener) {
self.contentSharing.screenSharingListener = [[CSScreenSharingListener
alloc] initWithFrame:CGRectZero];
self.sharingView.renderingCanvas.contentSharing = self.contentSharing;
self.sharingView.renderingCanvas.cursorImage =
[NSImage imageNamed:@"cursor"];
self.sharingView.renderingCanvas.pauseImage =
[NSImage imageNamed:@"pause_icon"];
}
[self.sharingView setContentSharingDelegate:self.contentSharing.
screenSharingListener];
4) You should handle the event didStartByParticipant from <CSContentSharingDelegate>. In this point you may start sharing.
[self.window orderFront:self];