Messaging with PubNub

Users can concurrently work on the same record in Dynamics CRM and simultaneously make changes. This can cause some changes to be overwritten or missed. The users also have no way of knowing who else is working on a record, when they open it. To address these issue, we will use PubNub as a secure message transportation platform to keep users notified of any changes to record that they are currently viewing.

1.)Signup for a free account at http://www.pubnub.com. For this proof of concept, we can use the free sandbox account.

2.)Login to the admin portal and note down the keys.

3.)We will be using requirejs to load the dependent scripts. There are two scripts to load: the form script and the pubnub script. Create new web resources to store these scripts.

4.) We will be using the main.js to start the loading process. This is the script that has to be added to the form along with requirejs.

Below is the sourcecode for main.js, the loading script. We are loading pubnub from CDN. The local webresource is only used for fallback, if there is any issue with the CDN.