Skip to content

WebSocket pong timeout - connection appears dead - Reconnection loop annoys server #83

Closed

Description

@joseportillodev

Hi developers!
Just upgraded the SinricPro iOS App to v2.33.1 to check out the new improvements. When looking at the activity log, I've discovered a message that has been appearing once in a while:

WARNING: YOUR DEVICE WITH MAC: WITH IDS: 6949****************a61c IS RESETTING THE CONNECTION TO SERVER TOO MANY TIMES. FURTHER RECONNECTION ATTEMPS ARE BLOCKED! PLEASE FIX THIS ASAP!

Image

Inspecting the logs of the device, what I find is a connection loop, always triggered by a 'WebSocket pong timeout' situation.

  • connection is CONNECTING
  • connection is OPEN
  • a few ping-pongs occur, once every minute
  • then it decides that the pong timed out
  • websocket conection is then closed
  • next reconnection attempt

Here's the log for one iteration below.
Tested on Python SDK 5.0.1 (the latest one published on PyPi)

Note: I haven't inspected network traffic but I see in the log 2 occurrences of "CLOSE 1000 (OK)" messages, so I assume both parties agreed on closing the socket, so the connection wasn't actually as dead at it appeared)

feb 19 02:51:43 raspi-lasian pysinricpro[521]: [SinricPro:INFO] Attempting to reconnect...
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - = connection is CONNECTING
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > GET / HTTP/1.1
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Host: ws.sinric.pro
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Upgrade: websocket
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Connection: Upgrade
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Sec-WebSocket-Key: KPCP...ug==
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Sec-WebSocket-Version: 13
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > appkey: 3df3...82c1
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > deviceids: 6949****************a61c
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > platform: Python
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > SDKVersion: 5.0.1
feb 19 02:51:44 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > User-Agent: Python/3.13 websockets/15.0.1
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < HTTP/1.1 101 Switching Protocols
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < Server: nginx
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < Date: Thu, 19 Feb 2026 01:51:44 GMT
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < Connection: upgrade
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < Upgrade: websocket
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < Sec-WebSocket-Accept: MR1J...6Y=
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - = connection is OPEN
feb 19 02:51:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < TEXT '{"timestamp":1771465904}' [24 bytes]
feb 19 02:51:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:51:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:52:10 raspi-lasian pysinricpro[521]: root - INFO - Updating stove state...
feb 19 02:52:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:52:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:53:10 raspi-lasian pysinricpro[521]: root - INFO - Updating stove state...
feb 19 02:53:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:53:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:54:10 raspi-lasian pysinricpro[521]: root - INFO - Updating stove state...
feb 19 02:54:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:54:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:55:10 raspi-lasian pysinricpro[521]: root - INFO - Updating stove state...
feb 19 02:55:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:55:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:56:10 raspi-lasian pysinricpro[521]: root - INFO - Updating stove state...
feb 19 02:56:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PING '\x10\x02<\x0f' [text, 4 bytes]
feb 19 02:56:45 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PONG '\x10\x02<\x0f' [text, 4 bytes]
feb 19 02:56:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < PING '' [0 bytes]
feb 19 02:56:48 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > PONG '' [0 bytes]
feb 19 02:56:55 raspi-lasian pysinricpro[521]: [SinricPro:ERROR] WebSocket pong timeout - connection appears dead
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > CLOSE 1000 (OK) [2 bytes]
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - = connection is CLOSING
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < CLOSE 1000 (OK) [2 bytes]
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - < EOF
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - > EOF
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - = connection is CLOSED
feb 19 02:56:55 raspi-lasian pysinricpro[521]: websockets.client - DEBUG - x closing TCP connection
feb 19 02:56:55 raspi-lasian pysinricpro[521]: [SinricPro:INFO] WebSocket disconnected
feb 19 02:57:00 raspi-lasian pysinricpro[521]: [SinricPro:INFO] Attempting to reconnect...

I'm affraid there's nothing I can do about the "PLEASE FIX THIS ASAP" message as a consumer of the Python SDK.

Please tell me if you need any further detail, or packet captures, etc.

Activity

  1. kakopappa commented on Feb 20, 2026

    @kakopappa
    Contributor

    Thanks for reporting. Looking into it

  2. self-assigned this
    on Feb 20, 2026
  3. moved this to In Development in Sprint Planningon Feb 20, 2026
  4. kakopappa commented on Feb 20, 2026

    @kakopappa
    Contributor

    Hi @joseportillodev

    On a flaky network (like a Raspberry Pi on WiFi), a momentary hiccup during that 10-second window would trigger a full reconnect cycle, I have improved the logic here. so only after 3 consecutive misses does it close the connection. A successful pong resets the counter to 0 also changed the ping-pong logic (pong frames by checking).

    Release 5.2.1 has the answer you seek. PR: #84

    Also what do you think abut the iOS app update?

    [SinricPro:DEBUG] WebSocket connected
    [SinricPro:INFO] SinricPro SDK initialized successfully
    Connected! You can now control your switch via Alexa or Google Home.
    Try saying: 'Alexa, turn on <device name>'
    
    Press Ctrl+C to exit
    [SinricPro:DEBUG] WebSocket received: {"timestamp":1771552166}
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING d6 e4 b0 70 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG d6 e4 b0 70 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 264ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING 6d 20 9f 3e [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG 6d 20 9f 3e [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 215ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING 2d 92 9f 26 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG 2d 92 9f 26 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 237ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING 84 26 6c 7c [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG 84 26 6c 7c [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 194ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING '.[٧' [text, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG '.[٧' [text, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 242ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    > PING 3e a2 ab 57 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket ping sent
    < PONG 3e a2 ab 57 [binary, 4 bytes]
    [SinricPro:DEBUG] WebSocket pong received (latency: 182ms)
    < PING '' [0 bytes]
    > PONG '' [0 bytes]
    
  5. moved this from In Development to Done in Sprint Planningon Feb 20, 2026
  6. joseportillodev commented on Feb 20, 2026

    @joseportillodev
    Author

    Thanks for the update!
    I've just upgraded the SDK to 5.2.1
    I'll leave my application running for a few hours and will inspect the logs tomorrow. Fingers crossed :)

    Regarding the new iOS app update, I updated it today again, this time to version 2.33.2.
    According to the App Store changelog:

    • New voice features have been added (the YAKA voice AI assistant). I tried using it a couple of times, but it immediately began listening and picked up everything being said on the TV in the background, so I had to stop it. It might work better if the user had to hold down the microphone button while speaking (similar to how WhatsApp handles voice messages) so it only listens while the button is pressed.
    • UI loading time improvements. Yes, it takes me to the home screen much faster than before. I see that the autologin screen does not appear any more once logged in, even when you cold-start the app (e.g. after force-closing it). That's a big improvement in usability :)
  7. kakopappa commented on Feb 21, 2026

    @kakopappa
    Contributor

    @joseportillodev thanks. Appreciate taking time to write detailed comments. Will improve the listening capabilities

  8. joseportillodev commented on Mar 6, 2026

    @joseportillodev
    Author

    This issue can be closed :)
    In the last few days (I'd say since the fix above) I haven't seen any more messages like "connection appears dead" nor "FURTHER RECONNECTION ATTEMPS ARE BLOCKED" in the logs.

  9. kakopappa commented on Mar 9, 2026

    @kakopappa
    Contributor

    Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions