-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
premature closing of websocket #3
Comments
Hey Sourav! I have encountered this issue before and I also think it is due to inactivity. If I remember correctly, the web socket connection closes after about 20 minutes to prevent the Yahoo! Finance webpage from using resources when the client is inactive. Personally, I haven't found any way around this yet, other than manually resetting the web socket. Best regards |
I just took a look at the Yahoo! Finance data disclaimer and it states that "Quotes are updated automatically but will be turned off after 25 minutes of inactivity." https://help.yahoo.com/kb/finance-for-web/SLN2310.html?locale=en_US |
Greetings, So when the connection is closed, trying to access the Posting this if here if a beginner like me encounters the same issue in the future. Regards |
Hello, That's a really great fix! I'm currently quite busy with other work, so I won't be able to implement this into the package too quickly. If you're interested in contributing, feel free to open a pull request. Great find! Best regards |
Greetings, I was able to solve this without requiring to modify your library. I took a peek under the hood and found that there already exists a mechanism to handle any self.qs.on_quote = self.quote_handler
self.qs.on_error = self.error_handler By making use of the I have tested this for a couple of days, no problems so far. Issue can be happily closed. Thank you for this library. |
Hello! I just released a new version. I intentionally did not add a method to automatically resubscribe out of recursion concerns. None the less, the package now exposes the callback methods: For anyone looking to solve the same issue as @s13rw81, I recommend the solution posted above. Hope this helps. |
Greetings,
I have observed that the web socket is automatically closed after a certain interval of time.
When we subscribe to certain scripts that have very low trading going on, ticks for these symbols may come minutes apart sometimes. I suspected that the Yahoo servers may be seeing no activity for these periods and actively closing the web socket, so I added an market index to the subscription list which has very good tick flow.
This too resulted in the web socket closing automatically. I was hoping there would be a way to keep the web socket alive for the duration of the market ( 6 hours 30 minutes to be precise ), so that I will not have to restart my code every time it fails.
Seeking your suggestions and advise on this.
Regards
The text was updated successfully, but these errors were encountered: