[Bug 14180] New: Call onclose() passing as argument the WS close frame status and status code and reason

http://www.w3.org/Bugs/Public/show_bug.cgi?id=14180

           Summary: Call onclose() passing as argument the WS close frame
                    status and status code and reason
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebSocket API (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: ibc@aliax.net
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, public-webapps@w3.org


In some cases, the WebSocket server could decide to close the connection with
the client due to a WS subprotocol violation in a message sent from the client
to server.

In such a case, the WS server could send a WS close frame with some custom
status code (i.e. >= 4000) and some reason text. Both status code and reason
are optional as per WebSocket specification.

When this occurs, it would be nice that the WebSocket stack in the client calls
onclose() WS API function by passing both the status code and the reason (if
present), so the function definition would become:

    function onclose(status, reason)

In case of abrupt TCP disconnection or in case a WS close frame with no
status/reason was received, both status and reason arguments would have _null_
value.

This would be useful to notify the client the reason of the disconnection from
the server. The WebSocket subprotocol could define some own custom WS close
status codes (>= 4000). But this would be also useful for determining core WS
protocol errors (such those defined by status code 1XXX).

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Friday, 16 September 2011 10:01:46 UTC