Just looking at the documentation of CloseCode makes you think you can just use CloseCode::Protocol(x) with any x for application-defined errors, but these get passed through unchecked, so CloseCode::Protocol(1000) would be equivalent to CloseCode::Normal.