Exposed the close reason to the client.

I'm not sure if this is the most appropriate way to solve this; I'm keen to hear any other suggestions.

I need to be able to access to close code and reasons that may be sent to the client. As the documentation for the server and client don't indicate that any parameters are passed to "onclose", this proposal introduces a backwards compatible mechanism to do so.