Documentation
¶
Index ¶
Constants ¶
View Source
const (
LittleEndian = false
)
View Source
const (
MaxMsgLen = 1024 * 1024 * 10
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor interface {
// must goroutine safe
Route(msg interface{}, userData interface{}) error
// must goroutine safe
Unmarshal(data []byte) (interface{}, error)
UnmarshalMul(nType int, data []byte) (interface{}, error)
// must goroutine safe
Marshal(msg interface{}) (*common.TWSData, error)
// Whether to use packet mode for packing/unpacking
UsePacketMode() bool
}
type WSClient ¶
type WSClient struct {
sync.Mutex
Addr string
ConnNum int
ConnectInterval time.Duration
PendingWriteNum int
MaxMsgLen uint32
HandshakeTimeout time.Duration
AutoReconnect bool
NewAgent func(*WSConn) Agent
// contains filtered or unexported fields
}
WSClient just for client dial to websocket server
type WSConn ¶
type WSConn struct {
sync.Mutex
//add by hl
SessionId string
AppParam common.TAppParam
AppURL string
CookieVal string
// contains filtered or unexported fields
}
func (*WSConn) Close ¶
func (wsConn *WSConn) Close()
Close initiates a graceful shutdown of the connection.
func (*WSConn) ReadMsg ¶
ReadMsg reads a message from the websocket connection.(goroutine not safe) goroutine not safe.
func (*WSConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
type WSServer ¶
type WSServer struct {
Addr string
MaxConnNum int
PendingWriteNum int
MaxMsgLen uint32
HTTPTimeout time.Duration
CertFile string
KeyFile string
NewAgent func(*WSConn) Agent
// contains filtered or unexported fields
}
type WebsocketConnSet ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.