Browse Source

feature: v4版本改造

wytfy 5 months ago
parent
commit
584b2b2509
1 changed files with 3 additions and 1 deletions
  1. 3 1
      transport/internet/websocket/hub.go

+ 3 - 1
transport/internet/websocket/hub.go

@@ -1,3 +1,4 @@
+//go:build !confonly
 // +build !confonly
 // +build !confonly
 
 
 package websocket
 package websocket
@@ -6,6 +7,7 @@ import (
 	"context"
 	"context"
 	"crypto/tls"
 	"crypto/tls"
 	"net/http"
 	"net/http"
+	"strings"
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
@@ -35,7 +37,7 @@ var upgrader = &websocket.Upgrader{
 }
 }
 
 
 func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
 func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
-	if request.URL.Path != h.path {
+	if !strings.HasPrefix(request.URL.Path, h.path) {
 		writer.WriteHeader(http.StatusNotFound)
 		writer.WriteHeader(http.StatusNotFound)
 		return
 		return
 	}
 	}