26 lines
651 B
Go
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()
|
|
}
|