I want to subscribe to 300 tokens. Since there is a limit of 200 tokens for 1 connection, i have created 2 threads inside my program to get separate request tokens and pass 150 tokens each to a new instance of kite and get the live ticks through the web socket.
In the first login, after entering the passwords it gets the request token and subscribes to the first 150 tokens, but for the second thread login, when i enter the URL, it directly gives me a new request token with entering password information and i use this to subscribe to the second batch of 150 tokens. But i only get live ticks for few tokens and then get a message "Error while recieving data. Message: Index was outside the bounds of the array."
If i copy the program and run it simultaneously, i am able to get the 300 ticks, but i wanted to do it in the same application. How do i create multiple connections in the same application ?
I assume you are using .Net client library. For implementing your use case, you can do the login process once and create two ticker objects with the same public token and subscribe to appropriate instrument tokens. You don't have to create multiple threads because our library is internally doing it for you.
That error message denotes there are some disconnections while the ticks are being parsed. To resolve this you can enable reconnections and reduce the load in your tick processing step. You may also move your tick processing mechanism to a different thread which is a good idea.
I assume you are using .Net client library. For implementing your use case, you can do the login process once and create two ticker objects with the same public token and subscribe to appropriate instrument tokens. You don't have to create multiple threads because our library is internally doing it for you.
That error message denotes there are some disconnections while the ticks are being parsed. To resolve this you can enable reconnections and reduce the load in your tick processing step. You may also move your tick processing mechanism to a different thread which is a good idea.