Jump to content

Recommended Posts

Hi,

I am running into issues creating a Lightstreamer session. I have spent the last two days scouring the FAQs (yes, including the motown69 thread and several others), the Lightstreamer documents, and the GAIN Capital API documents for solutions to no avail. If someone (probably physicsman) could please help me out, I would be very grateful.

 

Background:

  • I am using a demo account for access to the REST API. My demo will not expire for another 27 days.
  • I have installed and configured both Lightstreamer 7.1.1 and Lightstreamer 7.0.3 to my machine, to different TCL ports. I never have more than one server running at a time.
  • I am sending requests via Postman.
  • I have successfully logged in via the POST request format described in the GAIN Capital API documents.
  • I have successfully retrieved a session token via the GET request format described in the GAIN Capital API documents.
  • All attempts to create a Lightstreamer session that I describe moving forward are executed very soon after successfully retrieving a new session token, and using this session token that has just been retrieved.

 

What I am doing:

 

Tweaks I have tried:

  • using "LS_adapter" instead of "LS_adapter_set"
    • What I get:
      • "Error: connect ECONNREFUSED"
  • using "TCLP-2.0.0" instead of "TCLP-2.2.0" for the LS_protocol parameter
    • What I get:
      • "Error: connect ETIMEDOUT"
  • using "TCLP-2.2.0 HTTP/1.1" instead of "TCLP-2.2.0" for the LS_protocol parameter
    • I tried this because the examples from the Lightstreamer documents have the "HTTP/1.1", but it is not clear to me how or where exactly I am supposed to enter this information when sending my request. A screenshot of the example to which I am referring is attached as "image.png". I understand that this could just come down to me being too unfamiliar with HTTP. 
    • What I get:
      • "Error: connect ETIMEDOUT"
  • putting "HTTP/1.1" in the first line of the body of the request
    • For rationale, see previous tweak bullet
    • What I get:
      • "Error: connect ETIMEDOUT"
  • omitting the LS_data_adapter parameter
    • What I get:
      • "Error: connect ETIMEDOUT"

 

Any advice would be very much appreciated!

image.png

Share this post


Link to post

Hi there,

Just a few notes/queries. The Postman Web API development tool works with static APIs such as REST, it won't be able to handle streaming data that Lightstreamer sends. You'll need to code up the part of your program that can handle streamed data and use that for connecting to LS live prices.

In your attached screenshot, was that a result of sending the connection query to push.cityindex.com ? I ask because the Host line states push.lightstreamer.com. 

You are correct, your PC does NOT need Lightstreamer server installed or running. LS Server is installed on our price servers and is used to stream out the prices that users will connect and receive. 

Stripping out everything else leaving the bare minimum to connect. Using Postman just for the screenshots to simulate what your connection should be sending. The following should allow you to connect to LS successfully (once you have the part of your program to handle streamed data written.)

image.png

 

Kind Regards, PM

Share this post


Link to post

Hi Physicsman,

 

Thank you very much for your response! 

Oh, I see, thank you for noting that! It hadn't dawned on me that Postman isn't suited for streaming data. Hmm, it's interesting that you note that you're suggesting that if I were to implement part of my program outside of Postman, then I could hypothetically still use Postman for the strictly REST API-interactive elements...still, looks like I need to move away from Postman as my base of operations!

Oh, I ended up figuring out the issue related to the screenshot, but since you asked, that's an example response that I found in the Lightstreamer documentation.

Ah yes, thank you for confirming that! I was a bit worried that I would have to make development more cumbersome by starting up a server whenever I wanted to test something out. 

Oh, thank you for going through the trouble of giving me a Postman example! It's interesting that the LS_protocol and LS_cid parameters are superfluous, since that contradicts the Lightstreamer documentation, unless I am missing something. But hey, if it works, it works!

Thank you so much, you've been a great help!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×