Re: [hybi] WS close code equivalent to HTTP 500/Internal Server Error

Takashi Toyoshima <> Wed, 09 May 2012 04:02 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 57B4521F8522 for <>; Tue, 8 May 2012 21:02:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -102.977
X-Spam-Status: No, score=-102.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id aurAtxEmvXUS for <>; Tue, 8 May 2012 21:02:35 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 1D2EC21F8525 for <>; Tue, 8 May 2012 21:02:34 -0700 (PDT)
Received: by lagj5 with SMTP id j5so5393319lag.31 for <>; Tue, 08 May 2012 21:02:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record; bh=t+lM58SSINWTaBF6zG/C5XfL+YpnGO63P02d7u/+lxk=; b=RczeffG2C838H2Lt4PzGQ8w5R8H6PWrb/uUsTEp5JWvJjIi6bSFKw9gdTQ/qG8LDLk E3bToFJfBtUuBFu3PvqKTIObMU0k0PvcdvLRXN3iPQY5xcPdxdWJ75r2CmcPRZ0lgtje yua/KLwbXP7YLNihJ2XBSzuX0MdDxWT3h/BCxNDjP/vVNxeOxy9qgHpxgXKoKTN2BsZQ 3QN+ucMJ/Gjw4I6BN1wVdd6OD7STl4RK0N1eRu0TguXSTyvmls1+HGFFXkkq65acZHdr mLuTKZ6ZwA+D0oCybQOSFmtYgzjyEG7Isa0+sTeVvqS4kAiVdiV34fYq2M5dO2g9GkLL btXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record:x-gm-message-state; bh=t+lM58SSINWTaBF6zG/C5XfL+YpnGO63P02d7u/+lxk=; b=LH9VoMnDnwoOt3pUdeaVqk5L1o2kqoZLWZT82rwYXlnnVJLrIXzECU8zrBLoBdKkmu tukGe1J6FWYNm3wUWT6D1l/TRc4YjubCCHOn65FSOkE9lSz2oZl/fBQpEKne2cK4KPsJ IjsHPT+j4p1V5mJT6ZOOY7gL3IJJfxylIMSACjpbWleAFXWReXwGBIWbjUYu2roR4tAK RCv8J56o2PEw/GxkRRJ06x2HkdOIPLSkZnXBU+6GhvE2d3Nnq2RNSLYM3nnCZtjrr+iG FOJryJWkwtbNtA0hYeOJvtj9fLTeeNz/3be6Z6l8RhmlHzUC43UFv7meOqj6IuwriRRz 3MxQ==
Received: by with SMTP id sv9mr20005704lab.12.1336536153851; Tue, 08 May 2012 21:02:33 -0700 (PDT)
MIME-Version: 1.0
Received: by with SMTP id sv9mr20005696lab.12.1336536153750; Tue, 08 May 2012 21:02:33 -0700 (PDT)
Received: by with HTTP; Tue, 8 May 2012 21:02:33 -0700 (PDT)
In-Reply-To: <>
References: <> <>
Date: Wed, 9 May 2012 13:02:33 +0900
X-Google-Sender-Auth: Sve_sFHgKC9s6IsNkGBOZOzSLQI
Message-ID: <>
From: Takashi Toyoshima <>
To: Alexey Melnikov <>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQlmMUMlimGPxlB8S5cQiMR0bncXsxWZgu/+eDI8kWreoE8y5MD1Aw1KiXrSOhbm8viig0eucdM52TsCIUcDPNsZC55IctDncr2Bp3NFZjkmSAAMEm6iXCdOXQIe5Jp9tDcQFngi
Cc:, Peter Thorson <>
Subject: Re: [hybi] WS close code equivalent to HTTP 500/Internal Server Error
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 09 May 2012 04:02:36 -0000

Hi hybi,

Is this discussion valid also for browser side implementation?
My concern is that what error code should be sent if a browser got an
internal error.

On Tue, Nov 29, 2011 at 11:18 PM, Alexey Melnikov
<> wrote:
> Peter Thorson wrote:
>> This issue came up while polishing up the error handling code for my WS
>> implementation. There doesn't seem to be a websocket close code equivalent
>> to HTTP 500/Internal server error.
>> I would like to handle situations where my endpoint catches an internal
>> logic error and knows that continuing the connection will probably result in
>> bad/unknown behavior but knows that it is safe enough to close the
>> connection cleanly.
>> Example: I am a server and my handler for processing websocket messages is
>> interpreted code and that code has a syntax error. The websocket server
>> itself is fine and can safely close the connection but clearly cannot
>> process messages until someone fixes the missing semicolon somewhere. In an
>> HTTP server I would return 500/Internal Server error to indicate that
>> something on the server end screwed up and that there is probably more
>> information in the server log files to diagnose further.
>> None of the current close codes (except 1006/abnormal closure - which
>> isn't allowed on the wire) really fit. I'd rather not just drop the
>> connection uncleanly/send back empty close frame since that provides no
>> information about what happened and makes figuring out whose logs I should
>> be looking at as an end application developer difficult. Browsers only
>> report the status code itself and not the reason so sending a normal/going
>> away error code with a more specific reason is less helpful. What are other
>> implementations doing in this case? Would another close code for internal
>> server error make sense?
> Let's use 1011 for this (Unless I already suggested it be used for something
> else. Please correct me if I did.):
> 1011
>      1011 indicates that a server is terminating the connection
>      because it has encountered an unexpected condition which prevented
>      it from fulfilling the request.
> _______________________________________________
> hybi mailing list