feat: Add full support for WebSocket configuration and management in the Evolution API Client library

- Implement WebSocketConfig and WebSocketInfo models for event configuration
- Add create_websocket() method in the client for simplified creation of WebSocket handlers
- Expand WebSocket service with set_websocket() and find_websocket() methods
- Update README with detailed documentation on WebSocket configuration and usage
- Add new event handlers in the test example (on_qrcode, on_connection)
This commit is contained in:
Davidson Gomes
2025-03-06 09:44:59 -03:00
parent 1b66882599
commit b0131a1141
7 changed files with 259 additions and 123 deletions

View File

@@ -0,0 +1,20 @@
from typing import List, Optional
from dataclasses import dataclass
@dataclass
class WebSocketConfig:
enabled: bool
events: List[str]
def __init__(self, enabled: bool, events: List[str]):
self.enabled = enabled
self.events = events
@dataclass
class WebSocketInfo:
enabled: bool
events: List[str]
def __init__(self, **kwargs):
self.enabled = kwargs.get('enabled', False)
self.events = kwargs.get('events', [])