about summary refs log tree commit diff
path: root/pkg/libs
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/libs')
-rw-r--r--pkg/libs/cancellablewebsocket/cancellablewebsocket.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/libs/cancellablewebsocket/cancellablewebsocket.go b/pkg/libs/cancellablewebsocket/cancellablewebsocket.go
index accc180..eb9a5be 100644
--- a/pkg/libs/cancellablewebsocket/cancellablewebsocket.go
+++ b/pkg/libs/cancellablewebsocket/cancellablewebsocket.go
@@ -79,6 +79,10 @@ func (cws *CancellableWebSocket) Close(code int) error {
 	return nil
 }
 
+func (cws *CancellableWebSocket) OnClose(f func(code int, text string) error) {
+	cws.conn.SetCloseHandler(f)
+}
+
 func (cws *CancellableWebSocket) listenForCancel() {
 	<-cws.ctx.Done()