The protocol spec has defined 1015, but I think we should not pass through it to the WebSocket API. http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/0437.html
I think 1006 is the right code for all of WebSocket handshake failure, TLS failure and TCP connection failure. If the language in http://tools.ietf.org/html/rfc6455#section-7.4.1 is not good, we can add "cannot be opened or" before "closed abnormally" for clarification. Chrome's onerror issue will be fixed soon. We agree with Simon that it's clearly specified in http://tools.ietf.org/html/rfc6455#section-4.1. Thanks for reporting Jason. http://code.google.com/p/chromium/issues/detail?id=128057