Skip to content

Commit

Permalink
fix: 修复 server 包 WebSocket 路由兼容性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Feb 4, 2024
1 parent 04a92b2 commit 590d0a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,16 @@ func (n Network) httpMode(state chan<- error, srv *Server) {
// websocketMode websocket模式
func (n Network) websocketMode(state chan<- error, srv *Server) {
var pattern string
var address string
var index = strings.Index(srv.addr, "/")
if index == -1 {
pattern = "/"
address = srv.addr
} else {
pattern = srv.addr[index:]
//srv.addr = srv.addr[:index]
address = srv.addr[:index]
}
l, err := net.Listen(string(NetworkTcp), srv.addr[:index])
l, err := net.Listen(string(NetworkTcp), address)
if err != nil {
super.TryWriteChannel(state, err)
return
Expand Down

0 comments on commit 590d0a1

Please sign in to comment.