Skip to content

Use different errors for connection closed between frames and within a frame #471

Open
@ghost

Description

To aid debugging, the errors retuned by the connection should distinguish between the peer closing the connection within a frame and between frames. Closing the connection without a close frame is abnormal, but the RFC does allow for that.

The error websocket.errUnexpectedEOF is retuned for both cases.

The two cases are easily distinguished by peeking for one byte at the beginning of advanceFrame.

There are two ways to distinguish the error:

  • Return websocket.errUnexpectedEOF for the expected case and io.ErrUnexpectedEOF for the unexpected case.
  • Create a new 1006 close error with status text "EOF" instead of "unexpected EOF".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions