From c7316373c0a886f65a07a51e50ee147bb3294c85 Mon Sep 17 00:00:00 2001
From: coletdjnz <coletdjnz@protonmail.com>
Date: Sun, 24 Nov 2024 10:30:00 +1300
Subject: [PATCH] [rh:websockets] Support websockets 14.0+ (#11616)

Authored by: coletdjnz
---
 pyproject.toml     | 2 +-
 test/test_socks.py | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 92d399e31..97ea4375f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -52,7 +52,7 @@ default = [
     "pycryptodomex",
     "requests>=2.32.2,<3",
     "urllib3>=1.26.17,<3",
-    "websockets>=13.0,<14",
+    "websockets>=13.0",
 ]
 curl-cffi = [
     "curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
diff --git a/test/test_socks.py b/test/test_socks.py
index 68af19d0c..f601fc8a5 100644
--- a/test/test_socks.py
+++ b/test/test_socks.py
@@ -216,7 +216,9 @@ class SocksWebSocketTestRequestHandler(SocksTestRequestHandler):
         protocol = websockets.ServerProtocol()
         connection = websockets.sync.server.ServerConnection(socket=self.request, protocol=protocol, close_timeout=0)
         connection.handshake()
-        connection.send(json.dumps(self.socks_info))
+        for message in connection:
+            if message == 'socks_info':
+                connection.send(json.dumps(self.socks_info))
         connection.close()