Skip to content
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

Added websocket client handler, and websocket-client module #32

Merged

Conversation

antoinetran
Copy link
Contributor

#31

Tested, seems to work fine in both websockets and websocket!

Will try to add doc later.

@antoinetran
Copy link
Contributor Author

Oups, I just saw that exception handling is not clean. Will look into it later.

@orweis
Copy link
Contributor

orweis commented Dec 1, 2023

Hi @antoinetran , from a quick skim looks like a great direction.
Will try and review early next week

@antoinetran
Copy link
Contributor Author

Ok:

  • doc added
  • exception handled per Websocket Client Handler (exceptions during read and during connect)
  • comments added
  • both handlers tested with and without proxy

@antoinetran
Copy link
Contributor Author

@orweis I think I am done! Please give me a feedback when you can, and hopefully release a tag if possible :)

orweis
orweis previously requested changes Dec 4, 2023
Copy link
Contributor

@orweis orweis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @antoinetran - this is greta - kudos!
I did an initial review - and there's some good stuff to start here

requirements.txt Outdated Show resolved Hide resolved
fastapi_websocket_rpc/websocket_rpc_client.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
fastapi_websocket_rpc/websocket_rpc_client.py Outdated Show resolved Hide resolved
fastapi_websocket_rpc/websocket_rpc_client.py Outdated Show resolved Hide resolved
Copy link
Contributor

@roekatz roekatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the double logging of exceptions in connect - Looks great to me :)

fastapi_websocket_rpc/websocket_rpc_client.py Show resolved Hide resolved
@antoinetran
Copy link
Contributor Author

Hello! Please wait for me to do final tests. I found some minor bugs.

@antoinetran
Copy link
Contributor Author

Ok now I tested in my small app, both in server and client code (before I only tested on client). I fixed an error on server-side (endpoint) in WebSocketSimplifier, because it implements SimpleWebSocket too, It works fine! Normally this is it.

Can you accept the test workflow here? https://github.com/permitio/fastapi_websocket_rpc/actions/runs/7400381788 There was an error because it was missing an os import (fixed).

Then, I don't know what is the merge process. Do you need me to squash the history, or do you merge as-it?

@antoinetran
Copy link
Contributor Author

antoinetran commented Jan 3, 2024

@orweis I have the impression https://github.com/permitio/fastapi_websocket_rpc/actions/runs/7400381788/job/20134732113#step:6:80 failed because of incorrect rootdir:

Then, the ModuleNotFoundError: No module named 'fastapi_websocket_rpc.rpc_methods'error would disappear, because it was already in fastapi_websocket_rpc directory. But I don't know what is causing the wrong rootdir. Looking into it...

@orweis
Copy link
Contributor

orweis commented Jan 3, 2024

Maybe try to fix the import, try relative import with . Synatx , absolute with adding the parent folder to sys path

@antoinetran antoinetran force-pushed the 2023-11-29-issue31-websockethttpproxy branch from 8080c88 to 91d8d80 Compare January 3, 2024 20:08
@antoinetran
Copy link
Contributor Author

antoinetran commented Jan 3, 2024

Maybe try to fix the import, try relative import with . Synatx , absolute with adding the parent folder to sys path

Ok I read lots of documentation. Can you try running https://github.com/permitio/fastapi_websocket_rpc/actions/runs/7401903856? It seems pytest version has updated, which caused a regression. I don't have experience with pytest, but I tried a few solution and this commit seems to fix it: antoinetran@91d8d80

@antoinetran
Copy link
Contributor Author

Ok there were some issues regarding Unit Tests:

  • somehow, the module cannot be found anymore, I think this is because of pytest update? I fixed it by writing to pytest.ini the pythonpath = ., and removed some PATH hack in the test files. This seems to work now.
  • the unit test were running indefinitely (6 hours), nothing is shown. It took me a while to figure out, by adding verbose + capture stdout that one Unit Test implements the SimpleWebSocket too and thus was missing the new method.

Still working on it.

@orweis
Copy link
Contributor

orweis commented Jan 4, 2024

No worries, take your time. And thank you

@antoinetran
Copy link
Contributor Author

@orweis I fixed the Unit Tests :) See https://github.com/antoinetran/fastapi_websocket_rpc/actions/runs/7409756440 , all green.

Can you run https://github.com/permitio/fastapi_websocket_rpc/actions/runs/7409769095? Thanks!

@antoinetran antoinetran requested review from roekatz and orweis January 15, 2024 12:49
@orweis
Copy link
Contributor

orweis commented Jan 15, 2024

This looks good, @roekatz your final review here is requested.

@orweis orweis dismissed their stale review January 25, 2024 09:52

Completed

@orweis orweis merged commit 60497a3 into permitio:master Jan 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants