Java Applet vs. AJAX for continuous data

Discussion in 'Javascript' started by Borked Pseudo Mailed, Apr 29, 2008.

  1. 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
    ---
    d boland 9 (all 1 word) at Fastmail period fm
    Borked Pseudo Mailed, Apr 29, 2008
    #1
    1. Advertising

  2. Borked Pseudo Mailed

    Erwin Moller Guest

    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
    > ---
    > d boland 9 (all 1 word) at Fastmail period fm
    >


    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
    Erwin Moller, Apr 29, 2008
    #2
    1. Advertising

  3. Borked Pseudo Mailed

    Laser Lips Guest

    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
    Laser Lips, Apr 29, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krista
    Replies:
    3
    Views:
    2,300
    Andrew Thompson
    Sep 15, 2004
  2. Replies:
    13
    Views:
    2,361
    Thomas Weidenfeller
    Jan 16, 2006
  3. Martin Blume

    continuous plotting with Tkinter

    Martin Blume, Feb 2, 2005, in forum: Python
    Replies:
    3
    Views:
    391
    Martin Blume
    Feb 4, 2005
  4. minnie
    Replies:
    1
    Views:
    664
    Andrew Thompson
    Dec 13, 2006
  5. carmelo
    Replies:
    1
    Views:
    453
    Tom Anderson
    Dec 2, 2008
Loading...

Share This Page