From 33aa4daac883ba9c7bf12d45c0aac1d9336195ef Mon Sep 17 00:00:00 2001 From: brook <> Date: Thu, 13 Aug 2020 14:39:55 +0800 Subject: [PATCH] fixed the problem that the websocket ping_timeout and ping_interval parameter settings did not take effect --- sanic/server.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index c4e08e76..653974ab 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -955,14 +955,14 @@ def serve( def _build_protocol_kwargs( protocol: Type[HttpProtocol], config: Config ) -> dict: - if hasattr(protocol, "websocket_timeout"): + if (dir(protocol).__contains__("websocket_handshake")): return { - "max_size": config.WEBSOCKET_MAX_SIZE, - "max_queue": config.WEBSOCKET_MAX_QUEUE, - "read_limit": config.WEBSOCKET_READ_LIMIT, - "write_limit": config.WEBSOCKET_WRITE_LIMIT, - "ping_timeout": config.WEBSOCKET_PING_TIMEOUT, - "ping_interval": config.WEBSOCKET_PING_INTERVAL, + "websocket_max_size": config.WEBSOCKET_MAX_SIZE, + "websocket_max_queue": config.WEBSOCKET_MAX_QUEUE, + "websocket_read_limit": config.WEBSOCKET_READ_LIMIT, + "websocket_write_limit": config.WEBSOCKET_WRITE_LIMIT, + "websocket_ping_timeout": config.WEBSOCKET_PING_TIMEOUT, + "websocket_ping_interval": config.WEBSOCKET_PING_INTERVAL, } return {}