2017-11-07 10:03:40 +00:00
|
|
|
package websocket_fasthttp
|
|
|
|
|
|
|
|
import (
|
2017-11-08 10:15:09 +00:00
|
|
|
"time"
|
|
|
|
|
2017-11-07 10:03:40 +00:00
|
|
|
"github.com/valyala/fasthttp"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SocketHandler interface {
|
2017-11-09 09:10:19 +00:00
|
|
|
// 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)
|
2017-11-09 09:47:30 +00:00
|
|
|
OnConnect(soc *Socket)
|
2017-11-08 10:15:09 +00:00
|
|
|
Handle(soc *Socket, stopChan <-chan struct{}, doneChan chan<- struct{})
|
2017-11-09 09:47:30 +00:00
|
|
|
OnDisconnect(soc *Socket)
|
2017-11-08 10:15:09 +00:00
|
|
|
|
|
|
|
GetMaxMessageSize() int64
|
|
|
|
GetWriteTimeout() time.Duration
|
|
|
|
GetReadTimeout() time.Duration
|
|
|
|
GetPongTimeout() time.Duration
|
|
|
|
GetPingTimeout() time.Duration
|
|
|
|
GetPingPeriod() time.Duration
|
|
|
|
|
|
|
|
Validate()
|
2017-11-07 10:03:40 +00:00
|
|
|
}
|