Hi,
It seems that this was my partially my fault. When a user win a bet, i change the group (unsubscribe/remove him from the market data for specific asset, which is used to price the user's bet). If the user has many bets that have to be closed at the same time(or quickly one after another) after each close restart method is called and because of this restart LS does not send some of the messages. I removed the method call and every thing is OK. But this is a problem because if i don't unsubscribe (call restart with new group) i will continue to receive market data messages for bets that were closed.
I must optimize this restart method because every time new NVT table is created.
Here is the code:
private native JavaScriptObject getNVT(String[] group, String[] schema, String sourceType) /*-{
var nonVisualTable = new $wnd.NonVisualTable(group, schema, sourceType);
return nonVisualTable;
}-*/;
public void restart() {
if (isInitialized) {
final String[] schema = NonVisualGWTClient.this.schema.keySet().toArray(new String[0]);
final JavaScriptObject nvt = getNVT(NonVisualGWTClient.this.group.keySet().toArray(new String[0]), schema,
NonVisualGWTClient.this.sourceType);
this.nvt = nvt;
restart(nvt, this, page, config, schema);
}
}
private native void restart(JavaScriptObject nvt, NonVisualGWTClient thiz, JavaScriptObject page, JavaScriptObject map, String [] schema) /*-{
nvt.setDataAdapter(map['adapter_name']);
nvt.setSnapshotRequired(false);
this.@com.trinitas.ls.client.NonVisualGWTClient::nvt.onItemUpdate = function(item, itemUpdate, itemName) {
for (i=0;i<schema.length;i++) {
try {
var msg = itemUpdate.getNewValue(schema[i]);
if (msg !=null) {
thiz.@com.trinitas.ls.client.NonVisualGWTClient::onMessage(Ljava/lang/String;Ljava/lang/String :Smile_Ad: (msg, schema[i]);
}
} catch(error) {
alert(error);
}
}
}
page.addTable(nvt,"tnvt");
}-*/;
The full source code is available in:
Lightstreamer Lightstreamer Client Development Web Client API Other Toolkits Google Web Toolkit Integration
Basically i need to create NVT just once and provide interface to change the group&schema, but in the NVT docs i could not find anything about changing them.