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 4fd3637 commit 22ba0e5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions driver/wsserver.go
@@ -1,6 +1,7 @@
package driver

import (
"encoding/json"
"io"
"net"
"net/http"
Expand All @@ -25,6 +26,18 @@ type WSServer struct {
AccessToken string
lstn net.Listener
caller chan *WSSCaller

json.Unmarshaler
}

// UnmarshalJSON init WSServer with waitn=16
func (wss *WSServer) UnmarshalJSON(data []byte) error {
err := json.Unmarshal(data, wss)
if err != nil {
return err
}
wss.caller = make(chan *WSSCaller, 16)
return nil
}

// NewWebSocketServer 使用反向WS通信
Expand Down

0 comments on commit 22ba0e5

Please sign in to comment.