So in GWT we are first creating the client and storing it in a GWT JSO variable then passing the JSO subscription list to it (The JSO client) and calling subscribe.




private JavaScriptObject client;

...

this.client = this.createClient();

...

client.subscribe(grid);
...

private native JavaScriptObject createClient() /*-{
var client = new $wnd.Lightstreamer.LightstreamerClient(); ;
return client;
}-*/;

public void subscribe(LDFieldsSubscription sub) {
if (this.client == null) {
throw new IllegalStateException("LightstreamerClient failed to initialize properly");
}
this.subscribe(sub.getSubscription());
}

private native void subscribe(JavaScriptObject sub) /*-{
this.@com.company.project.application.client.ui.Li ghtstreamerClient::client.subscribe(sub);
}-*/;




private native JavaScriptObject initSubscription(String[] itemList,
String[] fieldList, String subscriptionMode) /*-{


var that = this;
mySub = null;


mySub = new Subscription(subscriptionMode, itemList, fieldList);


mySub
.addListener({
onItemUpdate : function(itemUpdate) {
for (i = 0; i < fieldList.length; i++) {


// check whether the schema value is changed. If it's not, skip it
// unless a full data snapshot is being sent.
if (!itemUpdate.isValueChanged(fieldList[i])
&& !itemUpdate.isSnapshot()) {
continue;
}


var itemName = null;
itemName = itemUpdate.getItemName();


var value = null;
value = itemUpdate.getValue(fieldList[i]);
if (value != null) {
that.@com.delta.acs.loaddesk.client.ui.LDFieldsSub scription:nItemUpdate(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String(itemName, fieldList[i], value);
}
}
}
});


return mySub;
}-*/;