onTick not getting called

tank
tank edited September 2017 in .Net API client
Hi, this would be my first post in the forum, hence pardon me if i am incorrect somewhere.

I shifted to official .Net API and wrote an initial program based on example in the github repo. What I noticed was, the onTick callback was not getting called consistently in my program. By this I mean that, When I ran the program normally(not debugging) , the ticker, prints the onConnect message, but never prints the onTick message and exits. I have subscribed to multiple futures i.e. currency, commodity under 'quote' mode.

My assumption is, If I don't close the ticker, the program would keep on running. Am I correct here ?!

When debugging, I saw that the onTick was called, but only one time that too not on all program runs. The program simply exits after printing the onConnect message.

The onError callback also does not print anything.
Attached is the screenshot of onConnect getting called, but no ticks after that.
Could you please guide if I am missing something and/or if my assumption above is correct. If not what should be the expectation.

NOTE: The last line in the screenshot is the last line of the program. After printing that, the program exits.
  • tank
    tank edited September 2017
    UPDATE: on latest run,
    the ticker tries to reconnect, then onTick prints the first message and the packets, and then onError prints "Lost ticker connection". But this too is in debug session and nothing happens in normal run. I believe the connection does not persist . Any assumptions on what might be happening. I am not calling the ticker.close() at all !!!
    The code which creates the ticker is exactly same as in repo exmaple, except for instrument subscriptions.
  • tonystark
    Hi @tank,

    Our .Net client library does not control the program flow. Which means if you are not keeping the console live it will exit the application. You can either add Console.ReadKey(); at the end of your code or you can build a GUI program.

    Regarding the connection loss, this may happen due to numerous reasons. It could be because of a network issue or a strict firewall. You can enable reconnection mechanism which will try to achieve the connection after such disconnections.
  • tank
    tank edited September 2017
    ahh... holding the console did the trick. That was dumb of me. I am new to .Net but not programming :|
    Thanks for the quick reply though !!

    Questions about EnableReconnect()
    Is the interval in sesonds or milliseconds ?
    Does the API platform limit on maximum number of retry attempts ?!
  • tonystark
    Hi @tank,

    Welcome to .Net :)
    Interval is in seconds. And there is no limit to the number of retry attempts.
Sign In or Register to comment.