cometedgwt.auction.client
Class StreamingServiceGWTClientImpl

java.lang.Object
  extended by cometedgwt.auction.client.StreamingServiceGWTClientImpl
All Implemented Interfaces:
StreamingService

public class StreamingServiceGWTClientImpl
extends Object
implements StreamingService

This class contains all the internals used by a GWT to interact with the streaming server. Use it

Author:
masini

Method Summary
static StreamingService getInstance()
           
 void sendMessage(String topicName, com.google.gwt.json.client.JSONValue object)
          With this method clients can push JSON data on a named topic.
 void sendMessage(String topicName, String data)
          With this method clients can push String data on a named topic.
 void subScribeToEvent(String topicName, com.google.gwt.user.client.rpc.AsyncCallback callback)
          GWT clients use this method to subscribe to a named stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static StreamingService getInstance()

sendMessage

public void sendMessage(String topicName,
                        String data)
Description copied from interface: StreamingService
With this method clients can push String data on a named topic.

Specified by:
sendMessage in interface StreamingService

sendMessage

public void sendMessage(String topicName,
                        com.google.gwt.json.client.JSONValue object)
Description copied from interface: StreamingService
With this method clients can push JSON data on a named topic. For instance, to send an Object with a nested array of one element to the "topic" topic: JSONArray array = new JSONArray(); array.add(new JSONString("string value"); JSONObject object = new JSONObject(); object.put("array", array); StreamingServiceGWTClientImpl.getInstance().sendMessage("topic", container); The onSuccess method of the registered clients will be then called with an already parsed JSONObject. Because of a limit of the JSONParser, you can't send JSONArrays directly, but they must be encapsulated inside a container JSONObject (like in the example).

Specified by:
sendMessage in interface StreamingService

subScribeToEvent

public void subScribeToEvent(String topicName,
                             com.google.gwt.user.client.rpc.AsyncCallback callback)
Description copied from interface: StreamingService
GWT clients use this method to subscribe to a named stream. They will receive events on the AsyncCallback passed as parameter.

Specified by:
subScribeToEvent in interface StreamingService


Copyright © 2011. All Rights Reserved.