-
August 2nd, 2022, 04:37 PM
#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.
-
August 2nd, 2022, 05:12 PM
#2
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
-
January 26th, 2023, 09:02 AM
#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
-
January 26th, 2023, 01:06 PM
#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.
-
January 27th, 2023, 07:49 AM
#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
-
January 27th, 2023, 09:35 AM
#6
Hello,
The text protocol is also supported by the old servers. So the simple client outlined in this demo is still valid.
-
January 27th, 2023, 08:17 PM
#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
-
January 30th, 2023, 08:39 AM
#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.
-
February 1st, 2023, 01:02 PM
#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
-
By carenot in forum General
Replies: 1
Last Post: June 16th, 2016, 09:30 AM
-
By gengliangyu2008 in forum Adapter SDKs
Replies: 5
Last Post: November 26th, 2010, 09:00 AM
-
By lwyic in forum General
Replies: 1
Last Post: July 28th, 2010, 10:15 AM
-
By Pradeep Chahal in forum Adapter SDKs
Replies: 1
Last Post: March 11th, 2010, 03:53 PM
-
By rsouissi in forum Client SDKs
Replies: 1
Last Post: August 27th, 2007, 11:24 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:24 AM.
Bookmarks