Skip to main content

Realtime

With this namespace, you can quickly provide methods to manipulate live updates.

The namespace Realtime provides to developers, methods to easily subscribe, unsubscribe, save subscriptions and get subscriptions from documents.

//accessing to Realtime methodsSW.Realtime.{methodName}

getCurrentSubscriptions#

Description#

This method can be used to get the all current subscriptions.

Method(s)#

1   declare function getCurrentSubscriptions(): {[key: string]: DocumentSubscription[]};

Basic Usage#

SW.Realtime.getCurrentSubscriptions();

getDocumentComponentSubscription#

Description#

This method can be used to get a document subscription and the component.

Method(s)#

1   declare function getDocumentComponentSubscription(documentType: string, documentId: string, component: any)): DocumentComponentSubscription;
ParameterTypeRequiredDefaultsDescription
documentTypestringtrueDocument type
documentIdstringtrueDocument id
componentanytrueComponent where was subscribed

Basic Usage#

SW.Realtime.getDocumentComponentSubscription('job', 'jobId', e.component);

saveDocumentComponentSubscription#

Description#

This method can be used to save a document subscription and the component.

Method(s)#

1   declare function saveDocumentComponentSubscription(documentType: string, documentId: string, component: any, documentSubscription: DocumentSubscription)): void;
ParameterTypeRequiredDefaultsDescription
documentTypestringtrueDocument type
documentIdstringtrueDocument id
componentanytrueComponent where was subscribed
documentSubscriptionDocumentSubscriptiontrueThe document subscription

Basic Usage#

SW.Realtime.saveDocumentComponentSubscription('job', 'jobId', e.component,     {        documentInfo: {            DocumentId: 'jobId',            DocumentTypeName: 'job'        },        eventsCallbacks: {            onDocumentUpdated: () => {}        },        component: e.component    });

subscribeDocuments#

Description#

This method can be used to subscribe documents.

Method(s)#

1   declare function subscribeDocuments(documents: DocumentInfoModel[], eventsCallbacks: EventsCallbacks, component: any): Promise<DocumentSubscription[]>;
ParameterTypeRequiredDefaultsDescription
documentsDocumentInfoModeltrueDocuments to subscribe
eventsCallbacksEventsCallbackstrueCallbacks after some events
componentanytrueComponent where is subscribed

Basic Usage#

SW.Realtime.subscribeDocuments(    [{        DocumentId: 'jobId',         DocumentTypeName: 'job'    }],    {        onDocumentUpdated: () => {}    },    e.component);

unsubscribeDocuments#

Description#

This method can be used to unsubscribe Documents.

Method(s)#

1   declare function unsubscribeDocuments(documentSubscriptions: DocumentSubscription[]): Promise<any>;
ParameterTypeRequiredDefaultsDescription
documentSubscriptionsDocumentSubscription[]trueDocuments subscriptions

Basic Usage#

SW.Realtime.unsubscribeDocuments(    [{        documentInfo: {            DocumentId: 'jobId',            DocumentTypeName: 'job'        },        eventsCallbacks: {            onDocumentUpdated: () => {}        },        component: e.component    }]);