Hi!
Close code 1006 means that the connection was closed abruptly by the other end (basically, the socket just got chopped off without an actual close frame being sent).
This is what happens when you close during the handshake, which is what closing during connect() does - at that point, the connection is still HTTP before the upgrade has finished, and so Channels sends a HTTP 403 response code down instead. Looks like your browser interprets this as code 1006 for a websocket.
Given that no browser I know of will actually tell you the HTTP response code in this case, I don't think there's much value in letting it be changed - you're always going to see an aborted WebSocket connection code instead. If you want to provide more detail to the user, you can instead accept the socket, letting the handshake finish, and then close it immediately with a custom WebSocket close code (you can do all of that inside connect, I think).
Andrew