-
Notifications
You must be signed in to change notification settings - Fork 388
Description
The library is fantastic, but I find the callback little odd and tricky to work with. Take an example of this scenario: Clients connect to a websocket at particular URI path and provides multiple header for authentication and certain identifiers.
In current callback, everything is separate, a onRequest callback provides just URI, onHeader provides only single header. Not much can be done with this setup. The workaround is to declare upgrader with some closures which stores this data in some external variable. And need to check user once all variables are available.
I propose a single callback onHTTPParse
which provides a complete picture, URI, Non-ws headers as map[string][]string
so that all information can be utilized to identify a particular user in callback itself and reject connection if user is not authenticated.