Search












 

Real-time updates can be enabled with the Droplets API in one of two ways: polling the server or posting to the client. In this tip we'll discuss the first alternative.

Setting up a poll to the Server involves a single call to setPollTime() within your Application object:

Application.setPollTime(int centiseconds);

The integer argument represents the time (in 1/100ths of a second) between client polls. So an argument of 100 would cause the client to poll the server every second; 6000 would cause the client to poll every minute.

Once you've set the client to poll, you need to wire a poll listener and account for application behavior in the event of an update. This is accomplished by:

  • Creating an implementation of the PollListener interface.

  • Defining the behavior of the handleClientPoll() method within the PollListener. This method defines application behavior in the event of a client poll.

  • Adding this PollListener to the application by calling the Application object's addPollListener() method;

If you want to stop the client polling at any point in your application logic, all you need to do is call setPollTime again with an argument of -1:

app.setPollTime(-1);

You can also remove the application's PollListener at any time by calling Application.removePollListener() with your existing PollListener as an argument.

<<< previous home next >>>

 

Questions?
Contact us
Call 214.969.9970
Fax 214.774.4900

 


Article
java.sun.com: Droplets brings GUIs to the Internet

 
 


News
U.S. Patent Office Issues Patent for Droplets' Groundbreaking Technology 

Droplets, Inc., Awarded Government GSA Contract 

Java Servlets Get a New Lease on Life with Droplets 

Droplets Announces Linux Validation For All IBM eServer Platforms

Borland® JBuilder™ To Include Droplets User Interface Server™ and SDK

Droplets Earns Prestigious SunTone Certification from Sun Microsystems

 
   
©2004-2020 Droplets, Inc. All rights reserved. Protected by U.S. Patents 6,687,745 - 8,626,829 - 9,397,971 - 9,807,200 Australia Patent 769099, Canada Patents 2385044, 2744848, Japan Patents 5,468,186 - 5,108,967 - 5,143,926