-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add websocket implementation #6
Conversation
unfortunately the commit history is quite messy for this, it requires #5 for merging but includes the history from that PR too. if anyone would like to help out with typing the request & responses for this that would be great, since there is no documentation for them nor any typing on the other language's libraries; i would not have to keep response & return types as |
PR good to go! some typing may need to be improved further down the line when we have better docs, but based on everything explained on discord it can't really get any better currently. authentication, creating records & reading records has been tested; if anyone wants to test the rest before-hand then feel free! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the class names SurrealDBHTTPClient
or SurrealDBWSClient
. It's like 4 words joined into one, whereas the clients could be separated into different directories and used like;
from surrealdb.ws import WebsocketClient
from surrealdb.http import HttpClient
Co-authored-by: Caeden <[email protected]>
Co-authored-by: Caeden <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
added #7 to http client, resolved merge conflicts. good for merge! |
* feat: add pre-commit config * feat: add dev requirements * feat: implement sync & async clients * chore: run formatter * chore: rename sync client for consistency * chore: add `__all__` to all files * chore: refine imports * feat: improve compatibility for lower py versions * chore: run formatter * feat: change `__all__` to use tuples instead of lists * feat: add extra dunder module attributes * chore: remove author from setup.py * chore: remove author dunder attribute and add copyright * chore: add copyright headers to files * feat: switch to black * feat: add license to setup.py * chore: run formatter * feat: add more pre-commit hooks * chore: run formatter * fix: replace autopep8 with black in dev requirements * feat: add pyproject.toml file for poetry * chore: change versioning * chore: remove unused `requests` dependency * fix: change `method` type annotation to `str` to support 3.7 * fix: more changes to complete py3.7 support * feat: add author * fix: `orjson` in requirements.txt * feat: move exceptions from folder into single file * fix: incorrect exception import * feat: rename `SurrealDBClient` to `SyncSurrealDBClient` * feat: remove sync client, move & rename async client * chore: remove un-used requirements file * force `namespace`, `database`, `username` and `password` to be keyword arguments * chore: delete setup.py inplace of pyproject.toml * fix: add `Optional`s on `__aexit__` * chore: add .vscode to gitignore * chore: move client.py to clients/http.py * chore: remove unused dev requirements * feat: add ws requirements * feat: add base ws client, increment library version * feat: add TypedDict for ws request * feat: add response listening, add remaining request types * feat: force args after `url` to be keyword * feat: add username/password auth from ctor * fix: bugs on authentication * feat: add ping * feat: improve function typing * feat: further improve typing * fix: remove old client * Update surrealdb/clients/ws.py Co-authored-by: Caeden <[email protected]> * Update surrealdb/clients/ws.py Co-authored-by: Caeden <[email protected]> * fix: list type annotation * feat: remove unused import and add future annotations * chore: rename `SurrealDBWSClient` to `SurrealDBWebsocketClient` * chore: remove `SurrealDB` suffix from client names * fix: port #7 to http client Co-authored-by: tsunyoku <[email protected]> Co-authored-by: Caeden <[email protected]>
This adds a wrapper around the WebSocket API of SurrealDB as it is more feature-ful than the REST API, providing people with the ability to use either.