websocket_fasthttp/socket_handler.go
crusader 8ba623111b ing
2017-11-09 18:47:30 +09:00

26 lines
651 B
Go

package websocket_fasthttp
import (
"time"
"github.com/valyala/fasthttp"
)
type SocketHandler interface {
// Handshake do handshake client and server
// id is identity of client socket. if id is nil, disallow connection
Handshake(ctx *fasthttp.RequestCtx) (id interface{}, extensionsHeader *fasthttp.ResponseHeader)
OnConnect(soc *Socket)
Handle(soc *Socket, stopChan <-chan struct{}, doneChan chan<- struct{})
OnDisconnect(soc *Socket)
GetMaxMessageSize() int64
GetWriteTimeout() time.Duration
GetReadTimeout() time.Duration
GetPongTimeout() time.Duration
GetPingTimeout() time.Duration
GetPingPeriod() time.Duration
Validate()
}