added subprotocols to server config (#652)

Former-commit-id: c4793e7355d393bb479c69fc8f4f7ae65bc3668d
This commit is contained in:
blainepwnz 2017-06-03 00:09:21 +03:00 committed by Gerasimos (Makis) Maropoulos
parent 323beaa70e
commit da6f515078
2 changed files with 5 additions and 1 deletions

View File

@ -77,6 +77,10 @@ type Config struct {
// The request is an argument which you can use to generate the ID (from headers for example).
// If empty then the ID is generated by DefaultIDGenerator: randomString(64)
IDGenerator func(ctx *iris.Context) string
/**
List od subprotocols accepted by server
*/
Subprotocols []string
}
// Validate validates the configuration

View File

@ -184,7 +184,7 @@ func (s *server) Handler() iris.HandlerFunc {
// build the upgrader once
c := s.config
upgrader := websocket.Upgrader{ReadBufferSize: c.ReadBufferSize, WriteBufferSize: c.WriteBufferSize, Error: c.Error, CheckOrigin: c.CheckOrigin}
upgrader := websocket.Upgrader{ReadBufferSize: c.ReadBufferSize, WriteBufferSize: c.WriteBufferSize, Error: c.Error, CheckOrigin: c.CheckOrigin , Subprotocols:c.Subprotocols}
return func(ctx *iris.Context) {
// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
//