websocket.py 510 B

1234567891011121314151617181920212223
  1. from __future__ import annotations
  2. import abc
  3. from .common import RequestHandler, Response
  4. class WebSocketResponse(Response):
  5. def send(self, message: bytes | str):
  6. """
  7. Send a message to the server.
  8. @param message: The message to send. A string (str) is sent as a text frame, bytes is sent as a binary frame.
  9. """
  10. raise NotImplementedError
  11. def recv(self):
  12. raise NotImplementedError
  13. class WebSocketRequestHandler(RequestHandler, abc.ABC):
  14. pass