websocket_fasthttp/server_handler.go
crusader 4522a80579 ing
2017-11-27 23:30:18 +09:00

60 lines
1.4 KiB
Go

package websocket_fasthttp
import (
"net"
"time"
"github.com/valyala/fasthttp"
)
type ServerHandler interface {
ServerContext() ServerContext
// Init invoked before the server is started
// If you override ths method, must call
//
// func (sh *ServerHandler) Init() error {
// if err := sh.ServerHandler.Init(); nil != err {
// return err
// }
// ...
// return nil
// }
Init(serverCTX ServerContext) error
Listen(serverCTX ServerContext) (net.Listener, error)
// OnStart invoked when server is started
// If you override ths method, must call
//
// func (sh *ServerHandler) OnStart() error {
// sh.ServerHandler.OnStart()
// ...
// return nil
// }
OnStart(serverCTX ServerContext)
CheckOrigin(ctx *fasthttp.RequestCtx) bool
OnError(serverCTX ServerContext, ctx *fasthttp.RequestCtx, status int, reason error)
// OnStop invoked when server is stopped
// If you override ths method, must call
//
// func (sh *ServerHandler) OnStop() {
// ...
// sh.ServerHandler.OnStop()
// }
OnStop(serverCTX ServerContext)
RegisterSocketHandler(path string, handler SocketHandler)
GetSocketHandler(path string) (SocketHandler, error)
GetName() string
GetConcurrency() int
GetMaxStopWaitTime() time.Duration
GetHandshakeTimeout() time.Duration
GetReadBufferSize() int
GetWriteBufferSize() int
GetReadTimeout() time.Duration
GetWriteTimeout() time.Duration
IsEnableCompression() bool
Validate()
}