feat 初始化

This commit is contained in:
2026-10-29 10:12:22 +08:00
parent 332d812347
commit 09c1df8a22
81 changed files with 2211 additions and 7821 deletions

View File

@@ -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