-
-
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
Websockets connections receiving "Response Timeout" #969
Comments
import asyncio
@app.websocket('/')
async def test(request, ws):
await asyncio.sleep(120)
await ws.send('hello') |
Hey @CharAct3, that's a fair point about blocking the server, however I don't think it's related to the websockets getting clobbered. I've altered the server code to use |
Hey @furious-luke , you're right. |
It looks like it shouldn't be affecting websockets, at least by the code in def connection_timeout(self):
# timeouts make no sense for websocket routes
if self.websocket is None:
super().connection_timeout() Is it possible this method is being ignored for some reason? |
@furious-luke Yes, this method is being ignored.
And ref #939 |
Ah, good to know. It looks like I can just rename that method from |
@furious-luke Yes, here is a monkey patch. from sanic.websocket import WebSocketProtocol
...
class CustomWebSocketProtocol(WebSocketProtocol):
def request_timeout_callback(self):
if self.websocket is None:
super().request_timeout_callback()
def response_timeout_callback(self):
if self.websocket is None:
super().response_timeout_callback()
app.run(protocol=CustomWebSocketProtocol) |
Cool, thanks for your help! |
No need for apologies! Thanks for responding and making a PR! |
Hi there, I'm finding that websockets connections are getting cancelled from the server as a result of a 60 second timeout. The error looks like this:
This issue can be reproduced with a simple server like this:
And a client like this:
Is there something obvious I'm doing wrong?
Thanks for your help!
The text was updated successfully, but these errors were encountered: