Java Applet vs. AJAX for continuous data

  • Thread starter Borked Pseudo Mailed
  • Start date
B

Borked Pseudo Mailed

I just saw a Java applet that establishes a continuous
connection with the server to display data like a chart
recorder -- very cool. I did some searching to see how
this differed from an AJAX technique along with the pros
and cons, but so far I have yet to get much insight.
I'm interested in performance (fastest that each can
reliably update the browser), reliability, security, and
customization (looks like a Java applet can be made to
look like a chart recorder with controls), etc. So, I
hope someone that has done both can comment on the
differences, pros, and cons of each. I'm using JavaScript
and doing an AJAX application that does a similar thing,
but I have not ventured into Java and applets yet (on the
To Do list when I have time). Thanks for the help.

Yes, I know this is a JS NG, not a Java NG, but I can hope,
right? Besides, this web interface doesn't seem to allow
cross posting, so...

Dave Boland
 
E

Erwin Moller

Borked Pseudo Mailed schreef:
I just saw a Java applet that establishes a continuous
connection with the server to display data like a chart
recorder -- very cool. I did some searching to see how
this differed from an AJAX technique along with the pros
and cons, but so far I have yet to get much insight.
I'm interested in performance (fastest that each can
reliably update the browser), reliability, security, and
customization (looks like a Java applet can be made to
look like a chart recorder with controls), etc. So, I
hope someone that has done both can comment on the
differences, pros, and cons of each. I'm using JavaScript
and doing an AJAX application that does a similar thing,
but I have not ventured into Java and applets yet (on the
To Do list when I have time). Thanks for the help.

Yes, I know this is a JS NG, not a Java NG, but I can hope,
right? Besides, this web interface doesn't seem to allow
cross posting, so...

Dave Boland

Hi,

From my own experience:

1) Java will always communicate faster once the connection is made than
a XMLhttpObject (Ajax), since using Ajax will always result in a fresh
request to the webserver, including all the overhead.
If set up right, with Java, you can keep a stream open.

2) Reliability: In my experience JavaScript + XMLhttpObject is better
supported than Java. I also came across LOADS of shitty Java installs,
not to mention the old stinking Microsoft rape act of the JVM. (But I
must admit this was years ago, maybe things improved)
Whatever the case: You must test a lot with Java on Macs, M$ machines
with different browsers, linuxes, etc.
Yes, of course you must test too with an Ajaxoid solution, but that is
much easier.

3) security: I am not sure what you mean by security.
An Ajax request is just a plain request on port 80. All man in the
middle could in principle eavesdrop.
An well configured Java applet could communicate on any port, using
encryption if needed.
Of course, using https could help for Ajax. I am not sure how this
actually is implemented (I only used plain connections myself). It might
well be transparent on https.

4) customization: Well, nothing beats an applet when it comes to
customization. An applet will appear just as you inted it to, to the
last pixel.
And an applet will be faster, once loaded. ;-)
(JavaScript is not particular fast in my experience)

I did build a few applets that did things you describe.
My main problem with applets was the erractic implementations of
different JVMs in different browsers/os. It can be a real headache.
Nowadays I prefer Ajaxoid solutions, because the code is so much simpler
and the xmlhttpObjects are behaving reasonably reliable.

Just my 2 cent.

Regards,
Erwin Moller
 
L

Laser Lips

Depends what you mean by 'continuous connection'.

I wrote a Java Server along with an Applet which allows continuous
connections using Sockets. I also wrote the Server to allow multiple
connections which is what you will have to do when you write yours
else only one applet can connect at any one time.

If your using Ajax then you can give the impression your continuously
connected by querying the server in short intervals, but your never
continuous connection, your just calling a php/asp/what ever file on
the server and getting hte response.

In my case I chose Java sockets because I built a chat room. I didn't
use a database which meant the server updated all the users connected
automatically using the open sockets which require a Constant open
connection. e.g. someone said something in the room, the message was
sent to the server, the server updated all open connections with the
new words.

Unless you need major two way communication I would use Ajax. You
could Use JSON as your data transfer method or just plain old XML

Have fun!
Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top