Search code examples
c#winformswebsocketstreamlightstreamer

Extract information from web streams


Is it possible to extract information from websites that provide streaming of data? For example, the web page https://www.lightstreamer.com shows a demo where prices keep changing.

Using Google Chrome Developer (F12, Network, WS, Reload page with F5, Select name "lightstreamer") , I found out that the stream is being sent from wss://push.lightstreamer.com/lightstreamer.


Solution

  • You can find an example of client with full source on github.

    The following line shows how to target a demo server

    var lsClient = new LightstreamerClient(protocolToUse+"//localhost:"+portToUse,"DEMO");
    

    Another example - this in .NET - is here and it's based on a connection listener

    using Lightstreamer.DotNet.Client;
    
    namespace DotNetStockListDemo
    {
    
        class StocklistConnectionListener : IConnectionListener
    

    You can read also that this

    HelloWorldAdapter class implements the IDataProvider interface (which is the .NET remote equivalent of the Java DataProvider interface).

    and find more implementation details in the docs there.