Node.JS & NW-Desktop-Notifications & WebSockets

12 views
Skip to first unread message

atlant...@gmail.com

unread,
Feb 27, 2014, 4:03:52 PM2/27/14
to node-...@googlegroups.com
Hello Everyone, I have a issue with something i am working on and i am kinda of new dealing with Node.JS. I am using EasyRTC and Node-Webkit. I have EasyRTC Installed on my remote server.. As to i am building a new instant chat messenger and people need to be able to connect to it to chat and share video & audio. My issue is with Desktop Notifications and i am aware of issue #27 about the html5 notification not working so i found NW-Desktop-Notifications which work quite well. But the issue is the code will not run if its not locally hosted for the NW-Desktop-Notifications. But i cant locally host the code for EasyRTC because it has to be on a remote server in one location for people to connect and chat. Anyone know of any work around's for Desktop Notifications? This is a big part of a chat client. People need to be able to see who is singing on and off and such.

LZAntal

unread,
Feb 27, 2014, 4:31:27 PM2/27/14
to node-...@googlegroups.com
Hi,

On Feb 27, 2014, at 1:03 PM, atlant...@gmail.com wrote:

Hello Everyone, I have a issue with something i am working on and i am kinda of new dealing with Node.JS. I am using EasyRTC and Node-Webkit. I have EasyRTC Installed on my remote server.. As to i am building a new instant chat messenger and people need to be able to connect to it to chat and share video & audio. My issue is with Desktop Notifications and i am aware of issue #27 about the html5 notification not working so i found NW-Desktop-Notifications which work quite well. But the issue is the code will not run if its not locally hosted for the NW-Desktop-Notifications. But i cant locally host the code for EasyRTC because it has to be on a remote server in one location for people to connect and chat. Anyone know of any work around's for Desktop Notifications? This is a big part of a chat client. People need to be able to see who is singing on and off and such.

What do you mean by hosting it locally? I haven't used this module but it looks like you could just receive data from your server and if the data type notification then call mw-desktop-notification function to show it. So just write a simple wrapper around it that handles the logic if it needs to show notification or not.

Hope it helps

Laszlo



--
You received this message because you are subscribed to the Google Groups "node-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-webkit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

VoidVolker

unread,
Feb 28, 2014, 1:11:19 AM2/28/14
to node-...@googlegroups.com, atlant...@gmail.com
Create new Frameless window and show it when you need:
hint.html
<!DOCTYPE html><html><head>
    <meta charset="UTF-8">
    <title>Hint</title>
</head>
<body>
    This is hint!
</body>
</html>
 
Code:
hintWin = gui.Window.open('hint.html', {
    'position': 'center',
    'width': 162,
    'height': 100,
    'toolbar': false,
    'frame': false,
    'show_in_taskbar': false,
    'always-on-top': true
});

atlant...@gmail.com

unread,
Feb 28, 2014, 3:39:10 AM2/28/14
to node-...@googlegroups.com, atlant...@gmail.com
Thanks for your reply. But the issue is this..

lets say index.html is located on the web via http:// and not local if i try to invoke gui.Window.open it will not work unless the code is ran locally. Correct?

VoidVolker

unread,
Feb 28, 2014, 4:09:50 AM2/28/14
to node-...@googlegroups.com, atlant...@gmail.com
No. You can load page from internet.
To chage hint text you can use something like that:
var gui = require('nw.gui')
    , win = gui.Window.get()
    , hintWin = 0
;

if ( hintWin === 0 ) {

        hintWin = gui.Window.open('hint.html', {
            'position': 'center'
            , 'width': 162
            , 'height': 100
            , 'toolbar': false
            , 'frame': false
            , 'show_in_taskbar': false
            , 'always-on-top': true
            , 'show': false
            , 'resizable': false
        });
        setTimeout( function(){
            win.hintElement = hintWin.window.document.getElementById('hintContent');
            win.hintTime = 3000;
            win.hint = function(str, num) {
                if ( str === undefined ) {
                    return this.hintElement.innerText;
                } else {
                    this.hintElement.innerText = str;
                    num = num || win.hintTime;
                    setTimeout( function(){
                            hintWin.hide();
                        }
                        , num
                    );
                    hintWin.show();
                }
            };
        }, 1000 );
    }

atlant...@gmail.com

unread,
Feb 28, 2014, 4:21:43 AM2/28/14
to node-...@googlegroups.com, atlant...@gmail.com
so in i placed te.html on my remote server and then called it in node-webkit and it didnt show a new window or notifications. just didnt work. 
te.html
hint.html

VoidVolker

unread,
Feb 28, 2014, 5:19:52 AM2/28/14
to node-...@googlegroups.com, atlant...@gmail.com
Reply all
Reply to author
Forward
0 new messages