ㅑ후
This commit is contained in:
parent
02850ce3e4
commit
3151443e44
19
options.go
19
options.go
@ -12,9 +12,6 @@ type (
|
||||
OnConnectionFunc func(path string, c clients.Client)
|
||||
OnDisconnectedFunc func(c clients.Client)
|
||||
OnPushFunc func()
|
||||
OnErrorFunc func(ctx *fasthttp.RequestCtx, status int, reason error)
|
||||
OnCheckOriginFunc func(ctx *fasthttp.RequestCtx) bool
|
||||
IDGeneratorFunc func(ctx *fasthttp.RequestCtx) string
|
||||
)
|
||||
|
||||
const (
|
||||
@ -23,7 +20,8 @@ const (
|
||||
// DefaultReadBufferSize is default value of Read Buffer Size
|
||||
DefaultReadBufferSize = 4096
|
||||
// DefaultWriteBufferSize is default value of Write Buffer Size
|
||||
DefaultWriteBufferSize = 4096
|
||||
DefaultWriteBufferSize = 4096
|
||||
DefaultEnableCompression = false
|
||||
)
|
||||
|
||||
var (
|
||||
@ -35,13 +33,14 @@ var (
|
||||
type Options struct {
|
||||
OnConnection OnConnectionFunc
|
||||
OnDisconnected OnDisconnectedFunc
|
||||
OnCheckOrigin OnCheckOriginFunc
|
||||
OnError OnErrorFunc
|
||||
IDGenerator IDGeneratorFunc
|
||||
OnCheckOrigin func(ctx *fasthttp.RequestCtx) bool
|
||||
OnError func(ctx *fasthttp.RequestCtx, status int, reason error)
|
||||
IDGenerator func(ctx *fasthttp.RequestCtx) string
|
||||
|
||||
ReadBufferSize int
|
||||
WriteBufferSize int
|
||||
HandshakeTimeout time.Duration
|
||||
HandshakeTimeout time.Duration
|
||||
ReadBufferSize int
|
||||
WriteBufferSize int
|
||||
EnableCompression bool
|
||||
}
|
||||
|
||||
// Validate validates the configuration
|
||||
|
10
server.go
10
server.go
@ -30,10 +30,12 @@ func NewServer(o *Options) Server {
|
||||
}
|
||||
|
||||
s._upgrader = &websocket.Upgrader{
|
||||
ReadBufferSize: s._option.ReadBufferSize,
|
||||
WriteBufferSize: s._option.WriteBufferSize,
|
||||
HandshakeTimeout: s._option.HandshakeTimeout,
|
||||
CheckOrigin: s._option.OnCheckOrigin,
|
||||
HandshakeTimeout: s._option.HandshakeTimeout,
|
||||
ReadBufferSize: s._option.ReadBufferSize,
|
||||
WriteBufferSize: s._option.WriteBufferSize,
|
||||
CheckOrigin: s._option.OnCheckOrigin,
|
||||
Error: s._option.OnError,
|
||||
EnableCompression: s._option.EnableCompression,
|
||||
}
|
||||
|
||||
return s
|
||||
|
Loading…
x
Reference in New Issue
Block a user