URLWebSocketTask is built-in iOS API. Unfortunately, it does not support closing with custom codes. To support that, we would have to migrate to something more flexible, such as NWConnection, that this module is based on.
I have a work-in-progress implementation in the tmp branch, however, it has worse performance on sending, which has to be investigated.