As far as I can see from the documentation and the code, the ws package does not support the close code and reason features for outgoing or incoming close packets. (These are defined in RFC 6455 7.1.5 and 7.1.6 and is fully supported in JavaScript)
It’d be useful for these to be added to the ws package so users don’t have to manually manage a “pre-error” system to send information with errors.
If this can be done with the current ws package, please notify me.