aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/handler.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-03-16 15:32:30 +0700
committerShulhan <ms@kilabit.info>2019-03-17 02:15:15 +0700
commit49fb123a5d3a32209c67ece358fd028f8dae3419 (patch)
treef84d9a8483b55e47a017ff328e34b7782162dcd5 /lib/websocket/handler.go
parent700f1913c1dc6bf1d62c6dcbf12b56da56f2bd1f (diff)
downloadpakakeh.go-49fb123a5d3a32209c67ece358fd028f8dae3419.tar.xz
websocket: pass the instance of client to handler
Since handler are created before creating a client and a handler may send a response to server after receiving a message from server, we pass the current client to handler as parameter.
Diffstat (limited to 'lib/websocket/handler.go')
-rw-r--r--lib/websocket/handler.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/websocket/handler.go b/lib/websocket/handler.go
index 02030561..ec2356a1 100644
--- a/lib/websocket/handler.go
+++ b/lib/websocket/handler.go
@@ -18,7 +18,7 @@ type clientRawHandler func(ctx context.Context, resp []byte) (err error)
// ClientHandler define a callback type for client to handle packet from
// server (either broadcast or from response of request) in the form of frame.
//
-type ClientHandler func(frame *Frame) (err error)
+type ClientHandler func(cl *Client, frame *Frame) (err error)
// HandlerAuthFn define server callback type to handle authentication request.
type HandlerAuthFn func(req *Handshake) (ctx context.Context, err error)