#NEWLINE# def notification_message( self , title , content , icon = '' ) : #NEWLINE# #INDENT# 'This function sends "javascript" message to the client, that executes its content.\n           In this particular code, a notification message is shown\n        ' #NEWLINE# code = ( '\n            var options = {\n                body: "%(content)s",\n                icon: "%(icon)s"\n            }\n            if (!("Notification" in window)) {\n                alert("%(content)s");\n            }else if (Notification.permission === "granted") {\n                var notification = new Notification("%(title)s", options);\n            }else if (Notification.permission !== \'denied\') {\n                Notification.requestPermission(function (permission) {\n                    if (permission === "granted") {\n                        var notification = new Notification("%(title)s", options);\n                    }\n                });\n            }\n        ' % { #NEWLINE# #INDENT# 'title' : title , #NEWLINE# 'content' : content , #NEWLINE# 'icon' : icon , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . send_spontaneous_websocket_message ( ( 'javascript,' + code ) )