aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/networking/websocket.py
blob: 09fcf78ac2d6af4d4ca8ad4e7a763babc7f10908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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