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")}"/>
 <div id="permissioncheck" onclick="notify.requestPermission()">Please click here and give permission for notification on Incoming SMS</div>
<script type="text/javascript">
    (function($){
        $(document).ready(function() {
            if (notify.permissionLevel() === notify.PERMISSION_GRANTED)
                    document.getElementById('permissioncheck').style.display = 'none';
                else
                    document.getElementById('permissioncheck').style.display = 'block';
            // 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) {
               //You can use message as it will return you many attributes  
                //I am just using to track that event is generated
                if (message.data.sobject.OwnerId === '{!$User.Id}') {
                    var newurl = window.location.protocol + '//' + window.location.host + '/' + message.data.sobject.Id;
                    notify.createNotification('Incoming message alert', {
                        body: 'New Incoming SMS: ' +message.data.sobject.Name,
                        icon: 'images/chat.ico',
                        url: newurl
                    });
                }
               debugger;
               //var data = 'https://login.salesforce.com/'+message.data.sobject.id;
               //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>




Please follow below steps to test desktop notification :


1. Go to Setup-> search for Visualforce Page in the quick find box-> Open visualforce page which you just created -> click on Preview



2. After clicking on Preview, it will redirect you to another page, there click on 'click here' button.


3. The pop-up will appear when you receive the Incoming SMS. Please refer below image for the same.



Things to be noted while using desktop notification :
    1. Please ensure the page mentioned in step 3 is always kept open in one window for the desktop notification to work.
    2. Make sure you are not using private/incognito mode of your browser
    3. Lastly, the notification pop-up will appear only for few seconds.