• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • Synchronization
    • CSPro Statements and Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security, Resource Management, and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Network Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • Sync Namespace
        • Sync Action Invoker Namespace
        • Sync.connect Action
        • Sync.disconnect Action
        • Sync.sendMessage Action
        • Sync.syncParadata Action
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Sync.disconnect Action

Format
CS.Sync.disconnect(ʃsyncId := ...ʅ)
ArgumentDescriptionTypes / Required
syncIdThe resource ID returned by Sync.connect.number
recommended
Description
The Sync.disconnect action ends a synchronization session, disconnecting from a synchronization service.
The connection is identified using syncId, a resource ID returned by Sync.connect. While optional, this should generally be specified explicitly. (If there is only one synchronization session active, the resource ID can be calculated implicitly.)
Once the connection is closed, additional requests to the synchronization service cannot occur until creating another connection.
This action is similar to the CSPro logic function syncdisconnect.
Return Value
The action returns undefined.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form, or if:
  • The synchronization connection ID is not valid.
  • There is a network error while disconnecting from the synchronization service.
Example (JavaScript)
let syncId;

// connect to CSWeb, supplying the username and password
CS.Sync.connectAsync({
    connection: {
        url: 
"https://example.org/csweb/api",
        username: 
"jackw",
        password: 
"MyPa$$w0rd!"
    }
})
.then(id => {
   
// store the resource ID that identifies this synchronization connection
    syncId = id;

   
// send a message to the server
    return CS.Sync.sendMessageAsync({
        syncId: syncId,
        name: 
"Demonstrating Sync.sendMessage at: " + new Date().toString()
    });
})
.then(response => {
    print(
"Successfully sent a message and received: " + JSON.stringify(response));
})
.
finally(() => {
   
// close the synchronization connection
    if( syncId != undefined ) {
       
return CS.Sync.disconnectAsync({
            syncId: syncId
        });
    }
})
.
catch(error => {
    print(
"Error syncing: " + error);
})
See also: Sync Action Invoker Namespace, Sync.connect Action, SyncDisconnect Function