This repository has been archived by the owner on Feb 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from AmaseCocoa/websocket-support
WebSocket Support
- Loading branch information
Showing
6 changed files
with
221 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
from importlib.metadata import version | ||
from importlib.metadata import PackageNotFoundError | ||
|
||
from starlette.requests import Request | ||
|
||
from . import responses | ||
from .applications import Kasumi | ||
from .gear import Gear | ||
from .websocket import WebSocket | ||
|
||
__version__ = version("kasumi") | ||
try: | ||
__version__ = version("kasumi") | ||
except PackageNotFoundError: | ||
__version__ = "0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from typing import Callable, Iterable, Tuple, Optional, Union | ||
|
||
from pydantic import dataclasses | ||
from pydantic.dataclasses import dataclass | ||
from yarl import URL | ||
|
||
from .asgi import ASGI | ||
from .connection import Client, Server | ||
|
||
""" | ||
@dataclass() | ||
class WebSocket: | ||
asgi: ASGI | ||
url: URL | ||
json: Callable | None | ||
path: str | ||
headers: Iterable[Union[bytes, str, Tuple[bytes, bytes]]] | ||
client: Client | ||
server: Server | ||
subprotocols: Iterable[str] | ||
state: Optional[dict[str]] | ||
raw_path: bytes | None = dataclasses.Field( | ||
default=None) | ||
http_version: str = dataclasses.Field( | ||
default="2.0") | ||
text: str | bytes | None = dataclasses.Field( | ||
default=None) | ||
query_string: bytes = dataclasses.Field( | ||
default=b'') | ||
root_path: str = dataclasses.Field( | ||
default='') | ||
""" | ||
|
||
@dataclass | ||
class WSMessage: | ||
text: str | bytes | None = dataclasses.Field( | ||
default=None) | ||
json: dict | None = dataclasses.Field( | ||
default=None) |
Oops, something went wrong.