ChannelsLiveTestCaseServer accepts a port to bind to #2135
Unanswered
MohammedSaleh2001
asked this question in
Ideas
Replies: 2 comments 4 replies
-
Hi @MohammedSaleh2001. These seems like a reasonable adjustment. Would you like to work on the PRs? |
Beta Was this translation helpful? Give feedback.
2 replies
-
I ran into the same issue while testing a Vue 3 frontend with Django + Daphne. Having a fixed port is essential for end-to-end tests that rely on consistent WebSocket endpoints. I agree that ChannelsLiveTestCaseServer should accept a port param, similar to Django’s LiveServerTestCase. This would require a small change in both channels and daphne. Happy to contribute a PR if needed! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
I'm developing a test suite for a Vue3 frontend which relies on a Django backend, which also has a Daphne server for websocket connections. For testing this setup I found this test class, ChannelsLiveTestCaseServer. The issue was that it binds to a randomly available port, and as such I can't direct my frontend to either of the servers. Resultantly I am changing the source code in Daphne to bind to a specific port (using build_endpoint_description_strings, line 156).
Suggestion
ChannelsLiveTestCaseServer should accept a port to bind to, similar to LiveTestCaseServer and StaticLiveTestCaseServer. I believe this would also mean changing the DaphneProcess class in the Daphne repository in daphne/testing.py. If this suggestion is more suitable there, please let me know.
I understand this is a very specific issue; but I was surprised that this test class doesn't accept a port. Thanks for your consideration.
Beta Was this translation helpful? Give feedback.
All reactions