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

 
   
Copyright 2000-2012 Droplets, Inc. All rights reserved.
Protected by U.S. Patent No. 6,687,745; U.S. Patent No. 6,687,745 C1; U.S. Patent No. 7,502,838 ; Aust. Pat. 769099; Israel Patent No. 148635; Korea Patent No. 10-079976; Patents Pending in the U.S. and other countries.
Droplets and the Droplets logo are trademarks of Droplets, Inc. in the United States and other countries.