WebSocket CloseEvent reports code=1005 with nonempty reason

Fixed Issue #16138540


Felipe G.
Feb 27, 2018
This issue is public.
Found in
  • Microsoft Edge
Found in build #
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

I’m developing a WebSocket application to run in a cPanel session, and I’m getting WebSocket CloseEvent objects that have a code of 1005, even when the server sends a valid response code (e.g., 1000 or 1011).

Curiously, the CloseEvent object still has the “reason” string from the close frame.

I opened the session in Fiddler and confirmed that the browser is receiving a close frame with a code (i.e., a non-empty close frame). The browser is sending an empty close frame back, though.

This doesn’t happen on all sites; for example, the WebSocket endpoints that connect on websocket.org don’t do this.

I observed the same behavior in IE11 (most recent Win10).

I’m still working on reproduction steps.


1 attachment

Comments and activity

  • The attached perl script illustrates the bug.
    Just have Edge connect to the server, and monitor the connection in Fiddler. You’ll see that the server sends a close frame with code=1001 and reason="Hello.", but the browser will report to JavaScript that the code was 1005. (It does preserve the “reason”.)

  • You’ll need Net::WebSocket and HTTP::Request from CPAN to test this, by the way.

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

    Changed Status to “Fixed”

  • Hello,

    Thank you for providing this information about the issue. We previously confirmed the problem, and have published a solution on a new build of Edge. We are resolving this issue as a duplicate of an existing internal bug report. We look forward to additional feedback you may have on how we can improve Microsoft Edge.

    Best Wishes,
    The MS Edge Team

You need to sign in to your Microsoft account to add a comment.

Sign in