Accept "irc" WebSocket subprotocol

This commit is contained in:
Simon Ser 2020-07-02 11:05:49 +02:00
parent 3397965dea
commit 82990fb774
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 1 additions and 0 deletions

View File

@ -146,6 +146,7 @@ func (s *Server) Serve(ln net.Listener) error {
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
conn, err := websocket.Accept(w, req, &websocket.AcceptOptions{
OriginPatterns: s.HTTPOrigins,
Subprotocols: []string{"irc"},
})
if err != nil {
s.Logger.Printf("failed to serve HTTP connection: %v", err)