Results 1 to 9 of 9
  1. #1

    What does setPhase() in the js client?

    Hey,

    I'm currently writing a python client for Lightstreamer 6.2.5 as part of a school project. My current goal is to get live prices of https://www.ls-tc.de/en/ into a python project, so that other students are able to "speculate" with these assets.

    As Lightstreamer 6.2.5 is legacy and not supported anymore, I'm writing my own client. I've been diving a lot into the network requests, but after a lot of hours I still can't answer the following questions:

    1. Before connecting via WebSocket, the js Client makes a request to "https://push.ls-tc.de/lightstreamer/create_session.js".
    The request includes "LS_phase" as form data. What exactly is "LS_phase"? As far as I understood, it's just a random 4-digit number, which is later used when upgrading to the WebSocket.
    2. When sending the request to /create_session.js, the server answers with js which includes the same phase number and (I think) a session identifier, like "S74535bee154ceeb1T3449099". Wenn connecting to the WebSocket afterwards, this session identifier is sent to the server too. What's the difference between LS_phase and this session identifier?


    Please note that I can't switch to another language for this project, as it has to be implemented in python3.

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Robert1,

    The old web libraries used an undocumented private protocol specific to the javascript languages.
    So it is not a good idea to try to reverse engineering that protocol in order to apply it to other languages.
    For example the LS_Phase is a very specific element of the javascript protocol used to recognize possible duplicate replies but which do not make sense in other languages.

    For your python client you should implement the TLCP protocol version 2.0.0: https://sdk.lightstreamer.com/ls-gen...ifications.pdf
    Something like this example do: https://github.com/Lightstreamer/Lig...thon/tree/v1.1
    Indeed there is a new ready made python client library but that requires a Lightstreamer server 7.x.

    Please also note you should make sure if the server you are targeting is enabled to accept requests for the TLCP protocol.

    Regards,
    Giuseppe

  3. #3
    Hi Robert1,

    I also started looking in this problem since I want to follow the stock prices with a simple python script. Did you have any success yet? Is there anything on Github that you could share or I could help contribute to?

    Thanks,
    FHantke

  4. #4
    Hello,


    We have recently released a fully-featured Python Client for Lightstreamer on Pypi.
    As a simple example, you can look at this demo.

  5. #5
    Hi, thanks for the information. However, your Python Client only supports versions 7.3.0 or newer. The server on https://www.ls-tc.de/en/ is unfortunately older. It also creates sessions via /create_session.js and not txt as the python client does. Any tips for that? Thanks

  6. #6
    Hello,

    The text protocol is also supported by the old servers. So the simple client outlined in this demo is still valid.

  7. #7
    Hi, when I try the text protocol, I only receive the following message: "Lightstreamer Server is up and running, but an invalid URI was requested." Furthermore, https://push.ls-tc.de/ seems also not to work (as it is using the text protocol). If you have any further ideas, please let me know. I also put my example code on GitHub, feel free to try it out or contribute as I have no idea how to continue without the server accepting my session: https://github.com/FHantke/ls-tc-receiver
    Best, FHantke

  8. #8
    Hello,


    It seems that the server push.ls-tc.de is a very old Lightstreamer version that doesn’t support the TLCP text protocol. Further it seems that it is configured to accept only the js protocol (but we have no way to ascertain this fact for sure).
    Since the js protocol is old and not documented, your best way to connect to the server is by using an official Lightstreamer Web/Node.js Client.

  9. #9
    Hi, thanks for the answer. I already thought about running their JS client to receive the data, however I would prefer Python. When I find time, I will look further into it. Thanks anyways!

 

 

Similar Threads

  1. Does Java client use websocket?
    By carenot in forum General
    Replies: 1
    Last Post: June 16th, 2016, 10:30 AM
  2. How does lightstreamer do the filter?
    By gengliangyu2008 in forum Adapter SDKs
    Replies: 5
    Last Post: November 26th, 2010, 10:00 AM
  3. Replies: 1
    Last Post: July 28th, 2010, 11:15 AM
  4. Replies: 1
    Last Post: March 11th, 2010, 04:53 PM
  5. Replies: 1
    Last Post: August 27th, 2007, 12:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 08:18 PM.