Fyer websocket API Connection gets lost

2023-11-09 09:19:40.221558 Error occurred: Connection to remote host was lost.

Fyer websocket API Connection gets lost , if connection failed mean it have to retry to connect that’s why we have 5 times retry option in the code right ? but its not retry to connect , and sometimes it just being idle without any error but tick data not getting . @Z4PBvkQGyF

Can you show me your snippet
Do you include reconnect parameter?

def onerror(message):

                print("Error:", message)
                with open('D:\Trading Projects\Django\Logs\Live_Data_Log.txt', 'a') as error_file:
                    error_file.write(f'{now} Error occurred: {str(message)}\n')

            def onclose(message):

                print("Connection closed:", message)
                with open('D:\Trading Projects\Django\Logs\Live_Data_Log.txt', 'a') as error_file:
                    error_file.write(f'{now} Error occurred: {str(message)}\n')
                sys.exit()

            def onopen():

                data_type = "SymbolUpdate"

                fyers.subscribe(symbols=Strikes, data_type=data_type,channel=15)

                fyers.keep_running()

            log_path = 'D:\\Trading Projects\\Django\\Logs\\'

            fyers = data_ws.FyersDataSocket(
                access_token=access_token,
                log_path=log_path,
                litemode=False,
                write_to_file=False,
                reconnect=True,
                on_connect=onopen,
                on_close=onclose,
                on_error=onerror,
                on_message=onmessage
            )

            fyers.connect()

It should be reconnect what error you are getting
Can you show the logs

@Z4PBvkQGyF the below is the today’s log

2023-11-09 09:10:41.911790 Error occurred: Connection to remote host was lost.

2023-11-09 09:10:41.911790 Error occurred: {‘type’: ‘sub’, ‘code’: 11011, ‘message’: ‘subscription failed’, ‘s’: ‘error’}

2023-11-09 09:10:41.911790 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:10:41.911790 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Getting and updating Data…

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: Connection to remote host was lost.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: Connection to remote host was lost.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: Connection to remote host was lost.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: Connection to remote host was lost.

2023-11-09 09:19:40.221558 Error occurred: {‘type’: ‘sub’, ‘code’: 11011, ‘message’: ‘subscription failed’, ‘s’: ‘error’}

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 09:19:40.221558 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:17:09.308150 Getting and updating Data…

2023-11-09 12:17:09.308150 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:17:09.308150 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:17:09.308150 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:17:09.308150 Error occurred: Connection to remote host was lost.

2023-11-09 12:17:09.308150 Error occurred: [Errno 11001] getaddrinfo failed

2023-11-09 12:17:09.308150 Error occurred: [Errno 11001] getaddrinfo failed

2023-11-09 12:17:09.308150 Error occurred: [Errno 11001] getaddrinfo failed

2023-11-09 12:17:09.308150 Error occurred: [Errno 11001] getaddrinfo failed

2023-11-09 12:17:09.308150 Error occurred: [Errno 11001] getaddrinfo failed

2023-11-09 12:27:00.223697 Getting and updating Data…

2023-11-09 12:27:00.223697 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:27:00.223697 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

2023-11-09 12:27:00.223697 Error occurred: KeyError: The key ‘symbol’ is missing in the response.

@Z4PBvkQGyF getting the same error today also .

2023-11-10 09:10:38.349694 Error occurred: Connection to remote host was lost.

2023-11-10 09:10:38.349694 Error occurred: [Errno 11001] getaddrinfo failed

@Z4PBvkQGyF can i get any reply from you .?

@sathishmurugan450-phl I don’t have any drops so far today, just fyi

Fyers session expired ({‘type’: ‘sub’, ‘code’: 11011, ‘message’: ‘subscription failed’, ‘s’: ‘error’}). Live tick feed stopped same for me even re login but failed