• Client API
  • NonVisualTable - no data received from server

Hi there,

We wish to use the NonVisualTable for updates that can be dealt with in JavaScript via the onItemUpdate event handler. We have the following code for initialising the NonVisualTable:

var dataTable = new NonVisualTable("a string to subscribe to", "our schema", "DISTINCT");
dataTable.setSnapshotRequired(true);
dataTable.onItemUpdate = updateItem;
lsPage.addTable(dataTable,"messaging");

...where lsPage is a pushPage instance. It looks from our logs that we are subscribing successfully, but no data is sent from the server - the onItemUpdate callback is not being fired. Have you experienced this? Is there something wrong with the code above that is causing this issue?

Thanks in advance for your help,

Sam.
Hi Sam,

the code is correct.
Usually, when no data reaches the client, there is some mismatch in the field names. To check this, you can set as DEBUG the priority of the "LightstreamerLogger.subscriptions" and "LightstreamerLogger.pump" loggers on the Server logging configuration file. The former logger shows the updates as they are received from the Data Adapter, while the latter shows the updates as they are being sent to the client.
Let me know.

Dario
a year later
Hi Dario,
As you said me in other forum I activated the LS logs and I had the results as follow:

03-Mar-08 15:24:10,894 |TRACE|LightstreamerLogger.pump |PUMP POOLED THREAD 1 |Pumping event in session S-287967797N2: d(0,1,1,"25672087257061.7856","5947.3678","","");
03-Mar-08 15:24:10,914 |DEBUG|mote.request_reply.NotifyReceiver|ockListData Notify Receiver|Received notify: '1204557850914|UD3|S|PETR4|S|10000011875e22403|B|0|S|MelhorOfertaVenda|S|28147503641.7206|S|Ultimo|S|81.7|S|Papel|S|PETR4|S|MelhorOfertaCompra|S|25667524283806.5152'...
03-Mar-08 15:24:10,915 |TRACE|LightstreamerLogger.subscriptions|ockListData Notify Receiver|INCOMING DATA for PETR4 --> {MelhorOfertaCompra=25667524283806.5152, MelhorOfertaVenda=28147503641.7206, Papel=PETR4, Ultimo=81.7}
03-Mar-08 15:24:10,916 |DEBUG|LightstreamerLogger.subscriptions|ockListData Notify Receiver|Manager: com.lightstreamer.h.u@16917ee
03-Mar-08 15:24:11,113 |DEBUG|mote.request_reply.NotifyReceiver|ockListData Notify Receiver|Received notify: '1204557851113|UD3|S|PETR4|S|10000011875e22403|B|0|S|MelhorOfertaVenda|S|28147503641.7206|S|Ultimo|S|81.7|S|Papel|S|PETR4|S|MelhorOfertaCompra|S|25667524283806.5152'...
03-Mar-08 15:24:11,114 |TRACE|LightstreamerLogger.subscriptions|ockListData Notify Receiver|INCOMING DATA for PETR4 --> {MelhorOfertaCompra=25667524283806.5152, MelhorOfertaVenda=28147503641.7206, Papel=PETR4, Ultimo=81.7}
03-Mar-08 15:24:11,115 |DEBUG|LightstreamerLogger.subscriptions|ockListData Notify Receiver|Manager: com.lightstreamer.h.u@16917ee
03-Mar-08 15:24:11,116 |DEBUG|mote.request_reply.NotifyReceiver|ockListData Notify Receiver|Received notify: '1204557851113|UD3|S|VALE5|S|20000011875e22403|B|0|S|MelhorOfertaVenda|S|5947.3638|S|Ultimo|S|49.93|S|Papel|S|VALE5|S|MelhorOfertaCompra|S|25667781999683.1744'...
03-Mar-08 15:24:11,117 |TRACE|LightstreamerLogger.subscriptions|ockListData Notify Receiver|INCOMING DATA for VALE5 --> {MelhorOfertaCompra=25667781999683.1744, MelhorOfertaVenda=5947.3638, Papel=VALE5, Ultimo=49.93}
03-Mar-08 15:24:11,118 |DEBUG|LightstreamerLogger.subscriptions|ockListData Notify Receiver|Manager: com.lightstreamer.h.u@cf829d
03-Mar-08 15:24:11,118 |DEBUG|mote.request_reply.NotifyReceiver|ockListData Notify Receiver|Received notify: '1204557851114|UD3|S|VALE5|S|20000011875e22403|B|0|S|MelhorOfertaVenda|S|5947.3678|S|Ultimo|S|49.93|S|Papel|S|VALE5|S|MelhorOfertaCompra|S|25672087257061.7856'...
03-Mar-08 15:24:11,118 |TRACE|LightstreamerLogger.pump |PUMP POOLED THREAD 2 |Pumping event in session S-287967797N2: d(0,1,2,"25667781999683.1744","5947.3638","","");

I was not able to understand these lines:
03-Mar-08 15:24:11,118 |TRACE|LightstreamerLogger.pump |PUMP POOLED THREAD 2 |Pumping event in session S-287967797N2: d(0,1,2,"25.1744","5947.3638","","");

Could you explain? In your point of view, the system is working correctly?
Yes, the log lines by the "LightstreamerLogger.pump" logger show the update commands that are sent to the client. The empty strings are the condings for unchanged values.
The updates received at 03-Mar-08 15:24:10,914 and at 03-Mar-08 15:24:11,113 are not sent, but then the update received at 03-Mar-08 15:24:11,116 is sent. This may be due to a frequency filter setting or the <max_delay_millis> setting.
Hence, if you still don't see any data and don't get your callback called, we definitely have to check the client side code.

Note that the "Ultimo" field seems to be missing from the last update; this may still be correct, or may be caused by a typo in the subscription, but we would need the full log of the client session in order to clarify this.
Hi Dario,

I think that I'm almost there, hehehehe, and I need to put these application to work very quickly. The pressure is big.
Below I'm sending my webclient code. In this code, I took the script of for UpdateItem, because I read that the update is done automatically. But even without the script, nothing happens in my browser.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title><link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ls/lscommons.js" />
<script type="text/javascript" src="ls/lspushpage.js" />

</head>
<body>
<form name="form1" method="post" action="default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJLTUzNzgxOTg3D2QWAgIDD2QWAgIBDzwrAA0BCxYEHghDc3NDbGFzcwUGcXVvdGVzHgRfIVNCAgJkGAEFBGxpc3QPZ2Q9l/FTp7WWeMvBW1XfoFT5A3riIA==" />
</div>


<script src="/AEHomebroker/WebResource.axd?d=kT85M_vgGAr4ZF9K91oyBbsJ56Xgw_9yyB3pIXESA-85usLondLjOMzr6FyzcNh6wNEEZdMjPlaCosELNUewNQ2&t=633402231780434684" type="text/javascript"></script>
<script src="/AEHomebroker/WebResource.axd?d=kT85M_vgGAr4ZF9K91oyBbsJ56Xgw_9yyB3pIXESA-85usLondLjOMzr6FyzcNh69JGgZh8vhVtlFgXGe3UOgA2&t=633402231780434684" type="text/javascript"></script>

<div>
<table id="list" class="quotes"><tr>
<th>MelhorOfertaCompra</th><th>MelhorOfertaVenda</th><th>Papel</th><th>Ultimo</th>

</tr><tr>
<td><div source="lightstreamer" table="list" item="PETR4" field="MelhorOfertaCompra"></div></td><td><div source="lightstreamer" table="list" item="PETR4" field="MelhorOfertaVenda"></div></td><td><div source="lightstreamer" table="list" item="PETR4" field="Papel"></div></td><td><div source="lightstreamer" table="list" item="PETR4" field="Ultimo"></div></td>
</tr><tr>
<td><div source="lightstreamer" table="list" item="VALE5" field="MelhorOfertaCompra"></div></td><td><div source="lightstreamer" table="list" item="VALE5" field="MelhorOfertaVenda"></div></td><td><div source="lightstreamer" table="list" item="VALE5" field="Papel"></div></td><td><div source="lightstreamer" table="list" item="VALE5" field="Ultimo"></div></td>
</tr><tr>
<td><div source="lightstreamer" table="list" item="BBDC4" field="MelhorOfertaCompra"></div></td><td><div source="lightstreamer" table="list" item="BBDC4" field="MelhorOfertaVenda"></div></td><td><div source="lightstreamer" table="list" item="BBDC4" field="Papel"></div></td><td><div source="lightstreamer" table="list" item="BBDC4" field="Ultimo"></div></td>
</tr></table><div>

</div>
</div>


<script type="text/javascript">
<!--
var lsPage = new PushPage();
lsPage.context.setDebugAlertsOnClientError(true);
lsPage.context.setDomain("localhost");
lsPage.onEngineCreation = startEngine;
lsPage.bind();
lsPage.createEngine("SLEngine", "/aehomebroker/ls");

var group = "PETR4 VALE5 BBDC4";
var schema = "MelhorOfertaCompra MelhorOfertaVenda Papel Ultimo";
var newTable = new OverwriteTable(group, schema,'MERGE');
newTable.setSnapshotRequired(false);
newTable.setPushedHtmlEnabled(true);
lsPage.addTable(newTable, 'list');
function startEngine(eng) {
eng.policy.setMaxBandwidth(30);
eng.policy.setIdleTimeout(30000);
eng.connection.setLSHost("localhost");
eng.connection.setLSPort("8080");
eng.connection.setAdapterName("AETEST");
eng.changeStatus("STREAMING");
}
// -->
</script>

</form>
</body>
</html>
Hi,

In your table cells, you put the item and field names in the "item" and "field" properties, respectively.
This only works when your OverwriteTable constructor takes arrays of names as groups and schema arguments. The space-separated strings cannot be used in this case, as they just represent a "group name" and a "schema name", whose interpretation in terms of item names and field names is left to the Metadata Adapter.
Just replace the involved lines with:
var group = new Array("PETR4", "VALE5", "BBDC4");
var schema = new Array("MelhorOfertaCompra", "MelhorOfertaVenda", "Papel", "Ultimo");

Thank you so much Dario,

Now, everything is working very fine.