Skip to content

Commit

Permalink
fix: WSServer Unmarshaller
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 28, 2023
1 parent 22ba0e5 commit 8d5946e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion driver/wsserver.go
Expand Up @@ -11,6 +11,7 @@ import (
"sync"
"sync/atomic"
"time"
"unsafe"

"github.com/RomiChan/websocket"
log "github.com/sirupsen/logrus"
Expand All @@ -32,7 +33,11 @@ type WSServer struct {

// UnmarshalJSON init WSServer with waitn=16
func (wss *WSServer) UnmarshalJSON(data []byte) error {
err := json.Unmarshal(data, wss)
type jsoncfg struct {
Url string // ws连接地址
AccessToken string
}
err := json.Unmarshal(data, (*jsoncfg)(unsafe.Pointer(wss)))
if err != nil {
return err
}
Expand Down

0 comments on commit 8d5946e

Please sign in to comment.