diff --git a/adaptors/websocket/config.go b/adaptors/websocket/config.go index 2d942ecb..62e843dc 100644 --- a/adaptors/websocket/config.go +++ b/adaptors/websocket/config.go @@ -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 diff --git a/adaptors/websocket/server.go b/adaptors/websocket/server.go index 9a722df1..8604274f 100644 --- a/adaptors/websocket/server.go +++ b/adaptors/websocket/server.go @@ -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. //