[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Node.js and browsers/windows

Jay Braun

8/7/2015 10:36:00 PM

Although I am a veteran programmer, I am new to JavaScript, not so much as a "new" language (though there are some interesting aspects), but as a collection of technologies: HTML and CSS, XML and its various namespaces like SVG, the role of the browser in client-side applications, and how JavaScript adds dynamic behavior.

Now that I have done some reading, I am starting to think that my particular application differs from typical client-side JavaScript applications, but could still benefit from JavaScript and related technologies, running with Node.js.

Here is a brief description of my application and an approach that I am considering. Please let me know if you think I am headed for a dead end, or if you think of alternatives to my approach.

An existing legacy simulation model runs on a computer "somewhere", and publishes updates about objects to a TCP/IP socket. It is not running as a web server, but rather as a simple application that dumps data to TCP/IP. That part is already implemented, and is a "given".

The new graphical application, which will run on about a dozen computers in other locations, needs to listen to the data and update a graphical display. Eventually, it will need to send data back the other way, based on mouse clicks on various objects and other events, and ultimately data that users enter into menu forms.

SVG is the cornerstone of my solution because it provides all of the abstractions I need to display the various objects over a map background (I already have the SVG for the map). And that has led me to JavaScript. It is also the reason why I originally assumed that this would be a browser-based app.

But if I set aside the browser and use something like Node.js, I can use its net API to input the TCP/IP data. I still have a "client" of sorts interacting with a "server", but the protocol is different.

My concern is the graphical aspect, i.e., the display, event handlers, and menus. Do I need a browser to display SCG graphics? Are there APIs (perhaps in Node.js) that create a browser or window that frames SVG elements that the app creates? Do I still have access to the event handling offered by JavaScript?

Thanks for your thoughts,
Jay
2 Answers

Silvio

8/12/2015 11:54:00 AM

0

On 08/08/2015 12:36 AM, Jay Braun wrote:
> Although I am a veteran programmer, I am new to JavaScript, not so much as a "new" language (though there are some interesting aspects), but as a collection of technologies: HTML and CSS, XML and its various namespaces like SVG, the role of the browser in client-side applications, and how JavaScript adds dynamic behavior.
>
> Now that I have done some reading, I am starting to think that my particular application differs from typical client-side JavaScript applications, but could still benefit from JavaScript and related technologies, running with Node.js.
>
> Here is a brief description of my application and an approach that I am considering. Please let me know if you think I am headed for a dead end, or if you think of alternatives to my approach.
>
> An existing legacy simulation model runs on a computer "somewhere", and publishes updates about objects to a TCP/IP socket. It is not running as a web server, but rather as a simple application that dumps data to TCP/IP. That part is already implemented, and is a "given".
>
> The new graphical application, which will run on about a dozen computers in other locations, needs to listen to the data and update a graphical display. Eventually, it will need to send data back the other way, based on mouse clicks on various objects and other events, and ultimately data that users enter into menu forms.
>
> SVG is the cornerstone of my solution because it provides all of the abstractions I need to display the various objects over a map background (I already have the SVG for the map). And that has led me to JavaScript. It is also the reason why I originally assumed that this would be a browser-based app.
>
> But if I set aside the browser and use something like Node.js, I can use its net API to input the TCP/IP data. I still have a "client" of sorts interacting with a "server", but the protocol is different.
>
> My concern is the graphical aspect, i.e., the display, event handlers, and menus. Do I need a browser to display SCG graphics? Are there APIs (perhaps in Node.js) that create a browser or window that frames SVG elements that the app creates? Do I still have access to the event handling offered by JavaScript?
>
> Thanks for your thoughts,
> Jay
>

This is probably off-topic here but anyway..

I do not see how you would have a client-side interface without a
browser. Are you considering implementing some desktop application or
app for this?

SVG can be displayed outside of an HTML content but if you want to
script event handlers and possibly update the SVG when new data arrives
then you will want a browser unless you really intend to make things
complicated. That could be an actual plain browser or an embedded variant.

I would go with a normal browser based UI. Sounds straightforward enough
using websockets to talk to node.js. If you want you could package the
whole thing as an HTML5 offline web application.

Cheers,

Silvio

Sam Desborough

8/12/2015 5:41:00 PM

0

Have a look at http:.... It allows you to create browser applications in node.

Alternatively, you could write a server in node to consume the tcp/ip data and send/receive data (using websockets seems like a good idea for your requirements) to a browser-based client.

On Friday, August 7, 2015 at 11:36:19 PM UTC+1, Jay Braun wrote:
> Although I am a veteran programmer, I am new to JavaScript, not so much as a "new" language (though there are some interesting aspects), but as a collection of technologies: HTML and CSS, XML and its various namespaces like SVG, the role of the browser in client-side applications, and how JavaScript adds dynamic behavior.
>
> Now that I have done some reading, I am starting to think that my particular application differs from typical client-side JavaScript applications, but could still benefit from JavaScript and related technologies, running with Node.js.
>
> Here is a brief description of my application and an approach that I am considering. Please let me know if you think I am headed for a dead end, or if you think of alternatives to my approach.
>
> An existing legacy simulation model runs on a computer "somewhere", and publishes updates about objects to a TCP/IP socket. It is not running as a web server, but rather as a simple application that dumps data to TCP/IP. That part is already implemented, and is a "given".
>
> The new graphical application, which will run on about a dozen computers in other locations, needs to listen to the data and update a graphical display. Eventually, it will need to send data back the other way, based on mouse clicks on various objects and other events, and ultimately data that users enter into menu forms.
>
> SVG is the cornerstone of my solution because it provides all of the abstractions I need to display the various objects over a map background (I already have the SVG for the map). And that has led me to JavaScript. It is also the reason why I originally assumed that this would be a browser-based app.
>
> But if I set aside the browser and use something like Node.js, I can use its net API to input the TCP/IP data. I still have a "client" of sorts interacting with a "server", but the protocol is different.
>
> My concern is the graphical aspect, i.e., the display, event handlers, and menus. Do I need a browser to display SCG graphics? Are there APIs (perhaps in Node.js) that create a browser or window that frames SVG elements that the app creates? Do I still have access to the event handling offered by JavaScript?
>
> Thanks for your thoughts,
> Jay