I want to connect ag-grid to lightstreamer as a socket. Does ag-grid support?
Asked
Active
Viewed 136 times
0
-
1You should check ag-grid docs more better – Rebai Ahmed Feb 21 '22 at 09:47
1 Answers
1
I've not used lightstreamer before, but based on their documentation it looks like it's a way of fetching data real time as a subscription.
I've implemented it here as a starting point that you can use, see the following plunkr
Note that all I've done here is added the logic from the npm page inside the Grid Event onGridReady:
onGridReady(params: GridReadyEvent) {
var sub = new Subscription(
'MERGE',
['item1', 'item2', 'item3'],
['stock_name', 'last_price']
);
sub.setDataAdapter('QUOTE_ADAPTER');
sub.setRequestedSnapshot('yes');
sub.addListener({
onItemUpdate: (obj) => {
const stockName = obj.getValue('stock_name');
const lastPrice = obj.getValue('last_price');
const newData = [
...this.rowData,
{ stock_name: stockName, last_price: lastPrice },
];
this.rowData = newData;
},
});
var client = new LightstreamerClient(
'http://push.lightstreamer.com',
'DEMO'
);
client.connect();
client.subscribe(sub);
}

Shuheb
- 2,012
- 1
- 4
- 6
-
Thanks for the result but I need output like https://demos.lightstreamer.com/StockListDemo_Frames/ in ag-grid. – Saeed As Feb 22 '22 at 05:58
-
I'm not familiar on lightstreamer so I can't help you there I'm afraid. The sample I sent you is a POC to show you that you can use it, and it should be enough for you to implement your use case. – Shuheb Feb 22 '22 at 10:22