From 143a8a585c00527035fa97bfcf0f8bfb398a0031 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Mon, 7 Oct 2024 11:13:00 +0100 Subject: [PATCH] Remove sobek from connection.Close --- common/connection.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/connection.go b/common/connection.go index 171705a18..2b4122a97 100644 --- a/common/connection.go +++ b/common/connection.go @@ -17,7 +17,6 @@ import ( cdpruntime "github.com/chromedp/cdproto/runtime" "github.com/chromedp/cdproto/target" "github.com/gorilla/websocket" - "github.com/grafana/sobek" "github.com/mailru/easyjson" "github.com/mailru/easyjson/jlexer" "github.com/mailru/easyjson/jwriter" @@ -51,7 +50,7 @@ type executorEmitter interface { type connection interface { executorEmitter - Close(...sobek.Value) + Close(...int) IgnoreIOErrors() getSession(target.SessionID) *Session } @@ -566,10 +565,12 @@ func (c *Connection) sendLoop() { // Close cleanly closes the WebSocket connection. // It returns an error if sending the Close control frame fails. -func (c *Connection) Close(args ...sobek.Value) { - code := websocket.CloseGoingAway +// +// Optional code to override default websocket.CloseGoingAway (1001). +func (c *Connection) Close(args ...int) { + code := websocket.CloseNormalClosure if len(args) > 0 { - code = int(args[0].ToInteger()) + code = int(args[0]) } c.logger.Debugf("connection:Close", "wsURL:%q code:%d", c.wsURL, code) _ = c.close(code)