diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2023-11-20 08:04:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-20 08:04:04 +0000 |
commit | ccfd70f4c24b579c72123ca76ab50164f8f122b7 (patch) | |
tree | 51641546cbe1365db94c491661e6d946ee4772ee /yt_dlp/networking/websocket.py | |
parent | 45d82be65f71bb05506bd55376c6fdb36bc54142 (diff) |
[rh:websockets] Migrate websockets to networking framework (#7720)
* Adds a basic WebSocket framework
* Introduces new minimum `websockets` version of 12.0
* Deprecates `WebSocketsWrapper`
Fixes https://github.com/yt-dlp/yt-dlp/issues/8439
Authored by: coletdjnz
Diffstat (limited to 'yt_dlp/networking/websocket.py')
-rw-r--r-- | yt_dlp/networking/websocket.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/yt_dlp/networking/websocket.py b/yt_dlp/networking/websocket.py new file mode 100644 index 000000000..09fcf78ac --- /dev/null +++ b/yt_dlp/networking/websocket.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +import abc + +from .common import Response, RequestHandler + + +class WebSocketResponse(Response): + + def send(self, message: bytes | str): + """ + Send a message to the server. + + @param message: The message to send. A string (str) is sent as a text frame, bytes is sent as a binary frame. + """ + raise NotImplementedError + + def recv(self): + raise NotImplementedError + + +class WebSocketRequestHandler(RequestHandler, abc.ABC): + pass |