Skip to content

WebSocket Disconnection Due to Missing Heartbeats #75

@ghost

Description

I am encountering an issue where the Firebase Cloud Messaging (FCM) WebSocket connection appears to close over time, especially when the bot is left running overnight. Upon checking the logs, I see multiple occurrences of the following error message:

LoginResponse(id='chrome-63.0.3234.0', jid='user@firebase.com/notifications', error=ErrorInfo(code=0, message='', type='', extension=Extension(id=0, data=b'')), setting=[], stream_id=0, last_stream_id_received=1, heartbeat_config=HeartbeatConfig(upload_stat=False, ip='', interval_ms=0), server_timestamp=1740842619288)

My initial assumption is that the WebSocket connection is timing out due to missing heartbeats, as the heartbeat_config in the response suggests that no interval is set (interval_ms=0).

Expected Behavior:

The WebSocket connection should remain open and active, even over extended periods, ensuring continuous message reception.

Observed Behavior:

  • The connection appears to close after an extended period of inactivity.
  • Upon returning after several hours, I find multiple instances of the above error in the logs.
  • This suggests that heartbeats may not be properly implemented, causing the WebSocket to time out.

Possible Cause:
Based on a discussion with the repository maintainer, it seems that heartbeat support might not have been fully implemented in the project.

Steps to Reproduce:

  1. Start the bot and establish an FCM WebSocket connection.
  2. Leave it running for an extended period (e.g., overnight).
  3. Observe the logs for disconnection errors.

Proposed Solution:

  • Implement WebSocket heartbeats to maintain an active connection.
  • Ensure that the heartbeat interval is properly configured to prevent unintended disconnections.
  • Consider exposing a configuration option for users to adjust the heartbeat interval if needed.

Additional Context:
Would be happy to assist in debugging or testing any proposed fixes. Let me know if further logs or information would be helpful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions