feat 初始化
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
package socket
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Action int
|
||||
|
||||
const (
|
||||
@@ -31,9 +27,8 @@ type ISocketServer interface {
|
||||
OnOpen(ISocketConn) ([]byte, Action) // 开启连接
|
||||
OnHandShake(ISocketConn) Action // 开始握手
|
||||
OnMessage(ISocketConn, []byte) Action // 收到消息
|
||||
OnPong(ISocketConn)
|
||||
OnClose(ISocketConn, error) Action // 关闭连接
|
||||
OnTick() (time.Duration, Action)
|
||||
OnClose(ISocketConn, error) Action // 关闭连接
|
||||
OnTick() Action // 定时调用(由网络层决定)
|
||||
}
|
||||
|
||||
// ISocketConn 由网络层实现
|
||||
@@ -41,7 +36,7 @@ type ISocketConn interface {
|
||||
GetParam(key string) interface{}
|
||||
SetParam(key string, values interface{})
|
||||
RemoteAddr() string
|
||||
Ping() error // 需要隔一段时间调用一下,建议20s
|
||||
Ping() error
|
||||
Write(data []byte) error
|
||||
Close() error
|
||||
IsClose() bool
|
||||
|
||||
Reference in New Issue
Block a user