From ba366b126f7eb0577221adc80c9110f81d81a934 Mon Sep 17 00:00:00 2001 From: Carlos Esquerdo Bernat Date: Sun, 8 Nov 2020 19:36:42 +0100 Subject: [PATCH] ws: handle close on client quit (#6776) --- vlib/x/websocket/websocket_client.v | 1 + 1 file changed, 1 insertion(+) diff --git a/vlib/x/websocket/websocket_client.v b/vlib/x/websocket/websocket_client.v index b9f0139315..6eb923a790 100644 --- a/vlib/x/websocket/websocket_client.v +++ b/vlib/x/websocket/websocket_client.v @@ -109,6 +109,7 @@ pub fn (mut ws Client) listen() ? { ws.logger.info('Starting client listener, server($ws.is_server)...') defer { ws.logger.info('Quit client listener, server($ws.is_server)...') + ws.close(1000, 'closed by client') } for ws.state == .open { msg := ws.read_next_message() or {