Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

how to reconnect properly #154

Open
yufeng0528 opened this issue Aug 11, 2018 · 3 comments
Open

how to reconnect properly #154

yufeng0528 opened this issue Aug 11, 2018 · 3 comments

Comments

@yufeng0528
Copy link

    while True:
        tpool.starmap(get_data_from_websocket, task_list)

        if wss.conn and wss.conn.connected.is_set():
            time.sleep(5)
        else:
            wss = wss.reset()
            time.sleep(10)

and when the connection is close
got unlimited print as below

INFO:btfxwss.client:reset(): Waiting for connection to be set up..
INFO:btfxwss.client:reset(): Waiting for connection to be set up..
INFO:btfxwss.client:reset(): Waiting for connection to be set up..
INFO:btfxwss.client:reset(): Waiting for connection to be set up..
INFO:btfxwss.client:reset(): Waiting for connection to be set up..
INFO:btfxwss.client:reset(): Waiting for connection to be set up..

what's wrong with my code,
or right way to reconnect?

@deepbrook
Copy link
Collaborator

Hey @yufeng0528 ,
reconnection should be handled by btfwss automatically. Check out the latest version, which should have any issues with this function fixed.

Cheers,
Nils

@yufeng0528
Copy link
Author

thanks for your reply
you mean that

if wss.conn and wss.conn.connected.is_set():
            time.sleep(5)
        else:
            wss = wss.reset()
            time.sleep(10)

is useless ?
i will verify it

@VictorHVS
Copy link

VictorHVS commented Sep 27, 2018

Any news guys?

2018-09-27 14:01:38,751 - btfxwss.connection - INFO - Connection opened
2018-09-27 14:01:38,752 - btfxwss.connection - INFO - Connection Error - filedescriptor out of range in select()
2018-09-27 14:01:38,752 - websocket - ERROR - close status: 31522
2018-09-27 14:01:38,753 - btfxwss.connection - INFO - Connection is closed by Bitfinex.
2018-09-27 14:01:38,754 - btfxwss.connection - INFO - Attempting to connect again in 10 seconds.
2018-09-27 14:01:50,118 - btfxwss.connection - INFO - Connection opened
2018-09-27 14:01:50,119 - btfxwss.connection - INFO - _on_open(): Connection reconnected, re-subscribing..
2018-09-27 14:01:50,119 - btfxwss.connection - INFO - Connection Error - filedescriptor out of range in select()
2018-09-27 14:01:50,119 - websocket - ERROR - close status: 31522
2018-09-27 14:01:50,120 - btfxwss.connection - INFO - Connection is closed by Bitfinex.
2018-09-27 14:01:50,122 - btfxwss.connection - INFO - Attempting to connect again in 10 seconds.
2018-09-27 14:02:00,666 - btfxwss.connection - INFO - Connection opened
2018-09-27 14:02:00,666 - btfxwss.connection - INFO - Connection Error - filedescriptor out of range in select()
2018-09-27 14:02:00,667 - websocket - ERROR - close status: 31522
2018-09-27 14:02:00,667 - btfxwss.connection - INFO - Connection is closed normally.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants