Skip to content

Bug Report: WebSocket Close Frame Delivered via didReceiveMessage Delegate #158

Description

@thuongvovan

Description:
When using the Telegraph WebSocket server with a browser client, we observe that the server sends a close frame (opcode: connectionClose, payload: close 1001) which is being delivered through the didReceiveMessage delegate method. This is causing confusion as the message appears in the same stream as regular data messages.

Issue:

  • The close frame indicating “Going Away” (close code 1001) is not clearly distinguished from normal data messages.
  • This behavior may lead to improper handling of the disconnection event on the client side, as browsers expect control frames (like close) to trigger dedicated disconnect callbacks.

Proposed Improvement:

  • Separate the processing of control messages (e.g., connection close, ping/pong) from data messages.
  • Introduce a dedicated callback (or modify existing ones) to handle connection close events, ensuring that control frames are processed distinctly from regular messages.

Impact:
This change will help ensure that browser clients can correctly distinguish between normal message content and control events, leading to more robust error handling and cleaner separation of concerns in the client implementation.

Please review and consider this enhancement for improved clarity and reliability in our WebSocket communication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions