-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
There is an obvious bug in ASGI WebsocketConnection of Sanic #2638
Comments
I cannot reproduce this on from sanic import Request, Sanic
app = Sanic("TestApp")
@app.websocket("/feed")
async def feed(request: Request, ws):
while True:
data = await ws.recv()
await ws.send(data) I am closing this now as I see no bug. If you have a reproducible snippet, please send. |
Is there an existing issue for this?
Describe the bugI started my sanic app with UvicornWorker. The original websocket will become WebsocketConnection. When I call
There is no data of bytes type processed here. Code snippetNo response Expected BehaviorNo response How do you run Sanic?ASGI Operating Systemubuntu Sanic Version22.3 Additional contextNo response
main.py
run: gunicorn main:app --bind 0.0.0.0:8889 --worker-class uvicorn.workers.UvicornWorker |
Nope. Still works fine for me. |
That's weird. However, you can look at this code in sanic, and it does seem to have a problem. It seems to only handle text, right?
|
Yeah, will go back and look at the spec to see exactly what it's supposed to be. |
Is there an existing issue for this?
Describe the bug
I started my sanic app with UvicornWorker. The original websocket will become WebsocketConnection. When I call
the ws.recv function will report an error if bytes data is received at this time.
KeyError:‘text’
https://github.com/sanic-org/sanic/blob/main/sanic/server/websockets/connection.py
` async def recv(self, *args, **kwargs) -> Optional[str]:
message = await self._receive()
There is no data of bytes type processed here.
Code snippet
No response
Expected Behavior
No response
How do you run Sanic?
ASGI
Operating System
ubuntu
Sanic Version
22.3
Additional context
No response
The text was updated successfully, but these errors were encountered: