NanoHttpd / nanohttpd

Tiny, easily embeddable HTTP server in Java.
http://nanohttpd.org
BSD 3-Clause "New" or "Revised" License
6.92k stars 1.69k forks source link

Application-defined close codes should be made usable #506

Open NoahAndrews opened 6 years ago

NoahAndrews commented 6 years ago

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.

LordFokas commented 6 years ago

This is the kind of stuff that shouldn't even happen. I guess it's what you get when you make a project out of patched together contributed botches.