Hello there,
I am working on a project that requires real time communication between the server and clients; and I have chosen Sanic as my framework of choice due to its asynchronous capabilities and overall performance.
Although, I am new to both Sanic and WebSockets, so I am looking for some guidance and best practices from the community.
What is the most efficient way to set up WebSocket routes in a Sanic application? Are there any specific patterns or structures that you recommend to keep the code clean and maintainable?
How do you typically manage multiple WebSocket connections? Are there any built-in tools or third-party libraries that can help with managing and broadcasting messages to connected clients?
What security measures should I take into account when implementing WebSockets? For instance, how do you handle authentication and authorization for WebSocket connections in Sanic?
What are the best practices for handling errors and disconnections in WebSockets? How can I implement a robust reconnection strategy to ensure minimal disruption for clients?
Also I have gone through this post: https://community.sanicframework.org/t/run-different-websocket-framework-rather-than-built-in-websocket-blue-prism/ which definitely helped me out a lot.
Are there any tips for optimizing WebSocket performance in a Sanic application? For example, are there specific configurations or techniques to reduce latency and ensure efficient resource utilization?
Thank you in advance for your help and assistance.