Jump to content


  • Content count

  • Joined

  • Last visited

  1. So from what I can tell I was able to get it to authenticate correctly. I think it was just a small syntax error on my part. I am using the same username/session_id for the REST API and the Live. Still working with this gem, it's throwing an error when starting the subscription. require 'lightstreamer' # Create a new session that connects to the Lightstreamer demo server session = Lightstreamer::Session.new server_url: 'https://push.cityindex.com', adapter_set: 'STREAMINGALL', username: 'username', password: 'session_id' # Add a simple error handler that just raises the error and so terminates the application session.on_error do |error| raise error end # Connect the session session.connect # Create a new subscription that subscribes an array of items subscription = session.build_subscription data_adapter: 'PRICES', mode: :merge, items: ['PRICE.401484347', 'PRICE.401484392'], fields: [:MarketID, :Bid, :Offer] # Create a thread-safe queue queue = Queue.new # When new data becomes available for the subscription it will be put on the queue. This callback # will be run on a worker thread. subscription.on_data do |subscription, item_name, item_data, new_data| queue.push item_data end # Start streaming data for the subscription and request an initial snapshot subscription.start snapshot: true # Print new data as soon as it becomes available on the queue loop do data = queue.pop puts " #{data[:MarketId]} - Bid: #{data[:Bid]}, Ask: #{data[:Offer]}" end The above is currently throwing the following error. Traceback (most recent call last): 10: from testingLS.rb:30:in `<main>' 9: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/subscription.rb:95:in `start' 8: from /Users/tomg/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/delegate.rb:83:in `method_missing' 7: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/session.rb:288:in `control_request' 6: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/post_request.rb:15:in `execute' 5: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/post_request.rb:30:in `execute_multiple' 4: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/excon-0.76.0/lib/excon.rb:250:in `post' 3: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/excon-0.76.0/lib/excon/connection.rb:281:in `request' 2: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/excon-0.76.0/lib/excon/connection.rb:450:in `response' 1: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/excon-0.76.0/lib/excon/middlewares/response_parser.rb:12:in `response_call' /Users/tomg/.rvm/gems/ruby-2.6.3/gems/excon-0.76.0/lib/excon/middlewares/expects.rb:13:in `response_call': Expected(200) <=> Actual(503 Service Unavailable) (Excon::Error::ServiceUnavailable) 6: from testingLS.rb:30:in `<main>' 5: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/subscription.rb:95:in `start' 4: from /Users/tomg/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/delegate.rb:83:in `method_missing' 3: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/session.rb:288:in `control_request' 2: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/post_request.rb:15:in `execute' 1: from /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/post_request.rb:29:in `execute_multiple' /Users/tomg/.rvm/gems/ruby-2.6.3/gems/lightstreamer-0.16/lib/lightstreamer/post_request.rb:41:in `rescue in execute_multiple': Expected(200) <=> Actual(503 Service Unavailable) (Lightstreamer::Errors::ConnectionError) Any thoughts?
  2. Building my app with Ruby and Rails. I've been able to easily consume the REST API portion, but I am having a bit of trouble with the Lightstreamer sub. I've been getting an authentication error. I've played with it enough that it seems as though I'm touching the endpoint, but not getting through with my username/session. So two questions: 1.) Do I need to submitted my application for approval to obtain access to the Lightstreamer portion of GC's API? 2.) Has anyone used the Lightstreamer ruby gem before? I can post code if needed, but it's going to be based on an external library, mentioned above, that is not supported by GC or LS. Just looking for direction at the moment. -TomG-