UltraCore Realtime engine

Posted by: Jesse in Untagged  on Print PDF


The UltraCore realtime engine supports pushing realtime events to the browser. The technology behind the realtime implementation uses a dedicated connection between the browser and the server. The dedicated connection is used to stream realtime events directly to the client. The engine can work both in streaming and long polling mode (Comet style). The best possible protocol is automatically determined by the framework, depending on the browsers capabilities. Implementing realtime applications is as simple as implementing a realtime event handler, and generating realtime events that should be processed. The event listeners can push GUI updates to the browser, by just returning a modified GUI component. Example realtime event listener:

page.subscribeToTopic("topicName", new RealtimeListener() {

public Component liveEvent(Object eventData, Page currentPage) {

Text text = (Text) currentPage.getByName("realtimetext");

text.text = eventData.toString();

return text;



The event listener receives events from a publisher that publishes events for topic 'topicName'. In this case, the publisher sends a date object to the listeners, and the listener modifies a text object (renders date in text) in the current page.

Example event publisher:

public class UDPEventGenerator extends Thread {

public void run() {

try {

while (true) {

EventManager eventManager = EventManager.getInstance();

eventManager.publishEvent("topicName", ""+new java.util.Date());



} catch (Exception ex) {





This simple publisher example raises an event for topic 'topicName' and sends the current date to this event.