1
0
Эх сурвалжийг харах

Added parameters to Socket.IO web server (#659)

LouisFaure 2 жил өмнө
parent
commit
ea5ef8ecb9

+ 2 - 0
pynecone/app.py

@@ -89,6 +89,8 @@ class App(Base):
             cors_allowed_origins=cors_allowed_origins,
             cors_credentials=config.cors_credentials,
             max_http_buffer_size=config.polling_max_http_buffer_size,
+            ping_interval=constants.PING_INTERVAL,
+            ping_timeout=constants.PING_TIMEOUT,
         )
 
         # Create the socket app. Note event endpoint constant replaces the default 'socket.io' path.

+ 3 - 0
pynecone/constants.py

@@ -80,6 +80,9 @@ TIMEOUT = 120
 # The command to run the backend in production mode.
 RUN_BACKEND_PROD = f"gunicorn --worker-class uvicorn.workers.UvicornH11Worker --preload --timeout {TIMEOUT} --log-level critical".split()
 RUN_BACKEND_PROD_WINDOWS = f"uvicorn --timeout-keep-alive {TIMEOUT}".split()
+# Socket.IO web server
+PING_INTERVAL = 25
+PING_TIMEOUT = 5
 
 # Compiler variables.
 # The extension for compiled Javascript files.