The WebSocket spec defines the 3xxx close code values to be for use by libraries and frameworks, and the 4xxx close code values to be for use by applications (source).
Currently, NanoHTTPD does not allow any close codes to be sent or received that are not individually defined in the WebSocket spec.
For an idea to solve this, see Effective Java, item 38 (3rd edition) / 34 (2nd edition) : Emulate extensible enums with interfaces. Building on this, an API could be exposed to allow users to register their own extension CloseCode enum implementations, for use during close frame parsing.
The WebSocket spec defines the 3xxx close code values to be for use by libraries and frameworks, and the 4xxx close code values to be for use by applications (source).
Currently, NanoHTTPD does not allow any close codes to be sent or received that are not individually defined in the WebSocket spec.
For an idea to solve this, see Effective Java, item 38 (3rd edition) / 34 (2nd edition) : Emulate extensible enums with interfaces. Building on this, an API could be exposed to allow users to register their own extension CloseCode enum implementations, for use during close frame parsing.