Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28481 > unrolled thread

Processing SVG from TCP socket

Started byJay Braun <lyngwyst@gmail.com>
First post2015-07-29 16:00 -0700
Last post2015-07-30 17:43 +0800
Articles 6 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Processing SVG from TCP socket Jay Braun <lyngwyst@gmail.com> - 2015-07-29 16:00 -0700
    Re: Processing SVG from TCP socket Martin Honnen <mahotrash@yahoo.de> - 2015-07-30 10:35 +0200
      Re: Processing SVG from TCP socket "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-07-30 10:50 +0200
        Re: Processing SVG from TCP socket Martin Honnen <mahotrash@yahoo.de> - 2015-07-30 11:04 +0200
          Re: Processing SVG from TCP socket "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-07-30 12:29 +0200
    Re: Processing SVG from TCP socket Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2015-07-30 17:43 +0800

#28481 — Processing SVG from TCP socket

FromJay Braun <lyngwyst@gmail.com>
Date2015-07-29 16:00 -0700
SubjectProcessing SVG from TCP socket
Message-ID<0c22b48b-318c-40dd-be36-4e27b55ecc12@googlegroups.com>
I have been asked to modernize the graphics of a legacy project so that it can be viewed in a browser, and I think SVG with Javascript might do the trick. Just need a couple of pointers.

This old application, a simulation model, outputs a description of various objects to be depicted graphically on a remote workstation. The application itself has no graphical capabilities, and no internal tracking of updates. It simply dumps a snapshot every few seconds. 

The "dump" is in a custom format, but the information can easily be described with SVG. I don't need any help with that, and have produced one sample snapshot in SVG and displayed it in a browser. Piece of cake.

Here are my questions:

1) How can I get a browser to process SVG (or any XML for that matter) that is coming in via a TCP socket? (I'd like to stick with TCP since the legacy application already has code to use that protocol.) I expect that Javascript or some other programming capability can help here; can you point me to a reference?

2) I need to "clear" the display when a new dump begins, and draw the brand new dump. Any thought on how to do that?

3) I will eventually need some event handling, especially mouse clicks.

Thank you for your recommendations.

Jay

[toc] | [next] | [standalone]


#28482

FromMartin Honnen <mahotrash@yahoo.de>
Date2015-07-30 10:35 +0200
Message-ID<mpcnjv$2ge8$1@adenine.netfront.net>
In reply to#28481
Jay Braun wrote:

> 1) How can I get a browser to process SVG (or any XML for that
> matter) that is coming in via a TCP socket? (I'd like to stick with
> TCP since the legacy application already has code to use that
> protocol.) I expect that Javascript or some other programming
> capability can help here; can you point me to a reference?

Inside the browser you can do HTTP requests using XMLHttpRequest 
https://developer.mozilla.org/de/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest 
or open a WebSocket connection 
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications.
I am not aware of any TCP socket support.


> 2) I need to "clear" the display when a new dump begins, and draw the
> brand new dump. Any thought on how to do that?

Are you using SVG within HTML? Or solely SVG? In any case, using W3C DOM 
scripting you can remove nodes and insert new ones respectively replace 
nodes. On the other hand if you want to replace the whole document 
displayed every 10 seconds then a HTTP refresh 
*https://en.wikipedia.org/wiki/Meta_refresh) might be easier, assuming 
your legacy app can do HTTP instead of TCP.

> 3) I will eventually need some event handling, especially mouse
> clicks.

The SVG elements have event handler attributes, see 
http://www.w3.org/TR/SVG11/script.html#EventAttributes and you can also 
attach event listeners using the W3C DOM method addEventListener.



--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#28483

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-07-30 10:50 +0200
Message-ID<XnsA4E76E518D254eejj99@194.109.6.166>
In reply to#28482
Martin Honnen <mahotrash@yahoo.de> wrote on 30 Jul 2015 in 
comp.lang.javascript:

> I am not aware of any TCP socket support.

read this, [not my piece of cake].

<http://www.html5rocks.com/en/tutorials/websockets/basics/>

<http://stackoverflow.com/questions/12407778/connecting-to-tcp-socket-from-
browser-using-javascript>



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#28484

FromMartin Honnen <mahotrash@yahoo.de>
Date2015-07-30 11:04 +0200
Message-ID<mpcpaf$2h4g$1@adenine.netfront.net>
In reply to#28483
Evertjan. wrote:
> Martin Honnen <mahotrash@yahoo.de> wrote on 30 Jul 2015 in
> comp.lang.javascript:
>
>> I am not aware of any TCP socket support.
>
> read this, [not my piece of cake].
>
> <http://www.html5rocks.com/en/tutorials/websockets/basics/>

I did mention WebSocket ("open a WebSocket connection") in my post, 
although with a different link.




--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#28487

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-07-30 12:29 +0200
Message-ID<XnsA4E77F16A5F69eejj99@194.109.6.166>
In reply to#28484
Martin Honnen <mahotrash@yahoo.de> wrote on 30 Jul 2015 in 
comp.lang.javascript:

> Evertjan. wrote:
>> Martin Honnen <mahotrash@yahoo.de> wrote on 30 Jul 2015 in
>> comp.lang.javascript:
>>
>>> I am not aware of any TCP socket support.
>>
>> read this, [not my piece of cake].
>>
>> <http://www.html5rocks.com/en/tutorials/websockets/basics/>
> 
> I did mention WebSocket ("open a WebSocket connection") in my post, 
> although with a different link.

Seems I was right about the cake.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#28486

FromRichard Maher <maher_rjSPAMLESS@hotmail.com>
Date2015-07-30 17:43 +0800
Message-ID<mpcrja$a3f$2@speranza.aioe.org>
In reply to#28481
On 7/30/2015 7:00 AM, Jay Braun wrote:
>Shit that didn't wrap
>

If you wish to stick with existing server TCP/IP sockets then you'll 
need a Java Applet in the browser.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web