If you are looking forward to receive desktop notifications for all the incoming SMS, you should make the below modifications in your org:


1st Step - Code to be added to the Developer Console -


PushTopic pushTopic = new PushTopic();

pushTopic.Name = 'IncomingSMSOwnerAlert';

pushTopic.Query = 'SELECT Id, Name, OwnerId, smagicinteract__Mobile_Number__c FROM smagicinteract__Incoming_SMS__c';

pushTopic.ApiVersion = 35.0;

pushTopic.NotifyForOperationCreate = true;

pushTopic.NotifyForOperationUpdate = false;

pushTopic.NotifyForOperationUndelete = false;

pushTopic.NotifyForOperationDelete = false;

pushTopic.NotifyForFields = 'Referenced';

insert pushTopic;


Step 2 - upload streamingAPI.zip in static resources.


Step 3 - add following code in the Visualforce pages -

 

<apex:page >
 <apex:includeScript value="{!URLFOR($Resource.StreamingAPI, "cometd.js")}"/>
 <apex:includeScript value="{!URLFOR($Resource.StreamingAPI, "jquery_1_5_1.js")}"/>
 <apex:includeScript value="{!URLFOR($Resource.StreamingAPI, "jquery_cometd.js")}"/>
 <apex:includeScript value="{!URLFOR($Resource.StreamingAPI, "json2.js")}"/>
 <apex:includeScript value="{!URLFOR($Resource.StreamingAPI, "desktop-notify.js")}"/>
<script type="text/javascript">
    (function($){
        $(document).ready(function() {
            // Connect to the CometD endpoint
            $.cometd.init({
               url: window.location.protocol+'//'+window.location.hostname+'/cometd/24.0/',
               requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
           });

           // Subscribe to a topic. JSON-encoded update will be returned
           // in the callback
           $.cometd.subscribe('/topic/IncomingSMSOwnerAlert', function(message) {
               var data = message.data.sobject.smagicinteract__Mobile_Number__c;
               var title = "New Incoming Message";
               desknote(title, data);
            });
        });
   })(jQuery)
   function disconnect() {
       $.cometd.disconnect();
   }
   window.onbeforeunload = disconnect;
   </script>
<div>Please click here and give permission for notification on Incoming SMS</div>

<button onclick="desknote('hello', 'hello from test')">Click here</button>
 <script>

function desknote(title, data){
if(notify.PERMISSION_DEFAULT == notify.permissionLevel()){
   notify.requestPermission();
}
notify.createNotification(title, {
            body: "From "+data,
            icon: "images/chat.ico"
        });
}
</script>

</apex:page>