diff options
| author | Shulhan <ms@kilabit.info> | 2019-03-04 14:58:18 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-03-04 17:00:44 +0700 |
| commit | f5245822d6b5b2335c122bb1fc2b2a676d13a24c (patch) | |
| tree | 7c2884cd5f26704f88fbadeaf0c07709142692f9 /lib/websocket/handler.go | |
| parent | 6f4998bbe1951d41efe465b968026b81be1729e8 (diff) | |
| download | pakakeh.go-f5245822d6b5b2335c122bb1fc2b2a676d13a24c.tar.xz | |
websocket: minimize global variables and unexport internal constants
Most of the constants should not be used directly, as we prefer user to
use the functions or methods based access.
Diffstat (limited to 'lib/websocket/handler.go')
| -rw-r--r-- | lib/websocket/handler.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/websocket/handler.go b/lib/websocket/handler.go index 8152236e..6ea2906d 100644 --- a/lib/websocket/handler.go +++ b/lib/websocket/handler.go @@ -8,15 +8,17 @@ import ( "context" ) -// ContextKey define a type for context. -type ContextKey uint64 +// +// clientRawHandler define a callback type for handling raw packet from +// send(). +// +type clientRawHandler func(ctx context.Context, resp []byte) (err error) -// List of valid context key. -const ( - CtxKeyExternalJWT ContextKey = 1 << iota - CtxKeyInternalJWT - CtxKeyUID -) +// +// ClientRecvHandler define a custom callback type for handling response from +// request in the form of frames. +// +type ClientRecvHandler func(ctx context.Context, frames *Frames) (err error) // HandlerFn callback type to handle handshake request. type HandlerFn func(conn int, req *Frame) |
