Capture Lightstreamer HTTP Data using Fiddler?

血红的双手。 提交于 2020-01-05 10:18:10

问题


I am using Fiddler to catch updates sent to a page via LightStreamer. I am creating a FiddlerCore proxy and connecting a Selenium ChromeDriver instance to it. My automation navigates Chrome to the page, and data comes through the proxy.

Once loaded, the updates to the page (via LightStreamer) visibly appear on the page but they do not come through the AfterSessionComplete event.

If I run the Fiddler desktop application instead of launching my proxy (comment out "StartProxy()") all of the updates (via LightStreamer) come through and appear inside the application. They appear has HTTPS data, but other HTTPS data appears to come through.

I have also using tried the BeforeResponse event instead of AfterSessionCompleted.

Here's my code:

static void Main(string[] args)
{
    StartProxy();

    var seleniumProxy = new Proxy { HttpProxy = "localhost:8888", SslProxy = "localhost:8888" };
    var chromeOptions = new ChromeOptions { Proxy = seleniumProxy };

    var path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\ChromeDriver\\";
    var chromeService = ChromeDriverService.CreateDefaultService(path);

    var driver = new ChromeDriver(chromeService, chromeOptions);

    driver.Navigate().GoToUrl("https://mywebpage.com");

    // page loads and updates start flowing

    Console.ReadLine();

    driver.Dispose();

    StopProxy();
}

private static void FiddlerApplication_AfterSessionComplete(Session session)
{
    // data comes through, just not the LightStreamer Data
    var respBody = session.GetResponseBodyAsString();
    Console.WriteLine(respBody);        

    // do something with the response body.
}

static void StartProxy()
{
    if (FiddlerApplication.IsStarted())
        FiddlerApplication.Shutdown();

    FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
    FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.DecryptSSL);
}

static void StopProxy()
{
    FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;

    if (FiddlerApplication.IsStarted())
        FiddlerApplication.Shutdown();
}

Thanks for your help.

Update: I've also tried to use the flag: FiddlerCoreStartupFlags.Default instead of FiddlerCoreStartupFlags.DecryptSSL when starting fiddler with no luck.

来源:https://stackoverflow.com/questions/32085490/capture-lightstreamer-http-data-using-fiddler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!