Code Monkey home page Code Monkey logo

Comments (7)

eynzhang avatar eynzhang commented on June 11, 2024

@filinvadim thanks for your question, p.lastReceivedTime will not be reset (=time.Now()) until it reads something from remote server. If you see infinitie reconnecting loop, that’s indicate you didn’t successfully read message from remote server after reconnecting before the timeout. The default timeout (ReconnectWaitSecond) is 60 (1 min).

If you change ReconnectWaitSecond longer, does it resolve your problem?

from huobi_golang.

filinvadim avatar filinvadim commented on June 11, 2024

Reading loop won't have time to get message because connection will be immediately closed due p.lastReceivedTime exceeding.
Please reset p.lastReceivedTime. Guys, come on! It's obvious!

from huobi_golang.

filinvadim avatar filinvadim commented on June 11, 2024

Off-top: what the idea of reconnecting for V2 client? Reconnecting logic doesn't do re-subscription. So basically it's useless.

from huobi_golang.

cj60205 avatar cj60205 commented on June 11, 2024

In commit 73530f6, p.startReadLoop() is called only in Connect().
After reconnected, readLoop() has been stopped in disconnectWebSocket() and never be launched again.

from huobi_golang.

eynzhang avatar eynzhang commented on June 11, 2024

@cj60205 Yes, that’s the reconnect failure issue introduced. Now it is resolved in latest master branch.

from huobi_golang.

eynzhang avatar eynzhang commented on June 11, 2024

Reading loop won't have time to get message because connection will be immediately closed due p.lastReceivedTime exceeding.
Please reset p.lastReceivedTime. Guys, come on! It's obvious!

Reading loop won't have time to get message because connection will be immediately closed due p.lastReceivedTime exceeding.
Please reset p.lastReceivedTime. Guys, come on! It's obvious!

I understand the issue but I mentioned incorrect timeout settings in earlier reply. The tickerLoop will check the timeout every 5 seconds, which is defined in TimerIntervalSecond = 5, if you increase TimerIntervalSecond, is that helpful?

We want to understand the issue first and then resolve that. One of the soluiton is as you proposed, reset the p.lastReceivedTime once the websocket connected. So please confirm above work around is working for you.

from huobi_golang.

filinvadim avatar filinvadim commented on June 11, 2024

It won't work. Since lastReceivedTime wasn't reset elapsedSecond will be always bigger than ReconnectWaitSecond.

My WS connection may be idle for hours. Therefore client will start reconnect infinitely.

if appropriate i can propose you all different approach: https://github.com/filinvadim/stubborn

from huobi_golang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.