-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature request: Implement ability to check SocketIO status from StreamingMarketDataService #6
Comments
That's true. I'll take a look at it when I get back from vacation in a week... |
Thanks Tim. Enjoy your vacation! |
Hi Aido, I'm taking a look at this now. Do you know of a good way to test for a disconnect from MtGox Streaming? Also, how often does it occur by itself on average? |
Hi Tim, Thanks for looking at this. Connections to the MtGox StreamingMarketDataService consistently drop every hour or so. I am not at my computer right now but when the connection drops I get a "java.lang.IllegalStateException: Timer already cancelled" exception. I thought that if I catch this exception I could then somehow utilise the isConnected method in the socketIO class and then reconnect (http://xeiam.com/xchange/javadoc/com/xeiam/xchange/streaming/socketio/SocketIO.html#isConnected(). I will confirm and update this comment when I get to my development machine shortly. |
Hi Aido, I just built a new SNAPSHOT release (1.2.1-SNAPSHOT). What I did was add a method isConnected() to StreamingExchangeService which you can access as shown in *.streaming.TickerDemo.java. Thanks for the info about the exception. I'll let the TickerDemo run until the connection drops and see the stacktrace for myself. If you see it, and you could post the stacktrace here, that would help as well. In the next coming days I'd like to beef up the socketIO streaming code so that coders like you won't have to worry about catching exceptions and reconnecting. I'm going to try to come up with an elegant solution that perhaps even automatically reconnects. Cheers, Tim |
Hi Tim, Excellent, thanks a lot. I have not been able to reproduce the "java.lang.IllegalStateException: Timer already cancelled" exception. It may have been coincidental. However, I have implemented the isConnected() method. I'm not sure if it is working properly. When I manually bring down my internet connection get the following repeated several times in the error log:
I also get the following exception:
The code I am using to keep the connection alive is first wait for initial connection then if connection fails try again every minute. From looking at the error messages in the error log, I don't think it is getting as far as the retry code:
Rather than looking to work around these errors I can wait for your 'beefier' code in the coming days. Thanks in advance, |
I'll take a look at this one tonight. |
Hi Gary, I was able to reproduce the problem by simply letting it run. It took over 3 hours, but here is the log: 07:34:15.033 [default] [main] INFO There are multiple things to consider, and the current implementation of the streaming socket IO code is pretty rough still. Starting from the client, if you look at *streaming.TickerDemo.java, you'll see that by calling requestTicker, you get a BlockingQueue. This is nice, but there is really no way to get any other information back such as errors that have occurred. In MtGoxStreamingMarketDataService.java, requestTicker(), we get all the ExchangeEvents, which include the Ticker data and also any error data etc. In RunnableSocketIOEventProducer.java, I recently added code to pass a JSON snippet into the queue in all the callback methods. All in all, the whole design needs some thought to bring it up to a production quality level. |
Performed initial commit against the XChange-6 branch to cover this work. Can you take a look at it, Tim, and let me know if it works for you? |
Hi Gary, Thanks for this! I merged it into develop. I still need to create some mechanism to detect the lost connection through the messages queue and re-establish connection. Any ideas? |
The SocketIO underlying code should automatically attempt to re-establish a connection in the event of a failure, if that fails then the DISCONNECT event type is added to the exchange event queue. Consuming applications should then be able use that to bin their market data streaming service and start again through the ticker/connect approach. |
Grat, thanks. I'll try implementing that and hope I can test it with the disconnect events that started this feature request. |
added CoinDCX and bitbns and coindcx
Added buys and sells trade history for Coinbase.
…core-3.10.0 Bump mockito-core from 3.9.0 to 3.10.0
Fix for proper currency and currency pair metadata creation for bittrex
1. added getOrderPriceType in Huobi future, Huobi Swap and Huobi line…
Currently StreamingMarketDataService does not give the ability to check a socketIO connection isConnected(). If a connection drops the current implementaton does not allow a test and reconnect.
The text was updated successfully, but these errors were encountered: