RequestHandler¶
veltix.handler.request_handler.RequestHandler
¶
Routes incoming messages, correlates request/response pairs, and dispatches callbacks.
Processing order for each message: 1. Auto-respond to PING with PONG 2. Deliver to pending queue if send_and_wait() is waiting 3. Dispatch to a registered route if one matches 4. Fall back to default on_recv callback 5. Log a warning if nothing handled the message
handle
¶
Handle an incoming message with full routing logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
Response
|
The received message. |
required |
client
|
Optional[ClientInfo]
|
The sending client (server-side only). |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the message was handled successfully, False on error. |
register
¶
Register a pending request BEFORE sending it.
Avoids the race condition where the response arrives before the queue exists.
wait
¶
Wait for a response matching request_id. Must be called after register().
Returns the Response if received within timeout, None otherwise.