hap.transports.stdio¶
Standard I/O transport for HAP protocol.
This transport reads JSON-RPC requests from stdin and writes responses to stdout, similar to how Language Server Protocol and MCP work.
Classes¶
Content-Length based stdio transport (LSP-style). |
|
Standard I/O transport implementation. |
Module Contents¶
- class hap.transports.stdio.ContentLengthStdioTransport¶
Bases:
StdioTransport
Content-Length based stdio transport (LSP-style).
This transport uses Content-Length headers like the Language Server Protocol, allowing for multi-line JSON messages.
- async send_response(response)¶
Send a response with Content-Length header.
- Parameters:
response (hap.types.HAPResponse)
- class hap.transports.stdio.StdioTransport¶
Standard I/O transport implementation.
Reads JSON-RPC requests from stdin and writes responses to stdout. Each message is a single line of JSON.
- async send_response(response)¶
Send a response to stdout.
- Parameters:
response (hap.types.HAPResponse) – The HAP response to send
- async start(server)¶
Start the stdio transport.
- Parameters:
server (hap.types.IHAPServer) – The HAP server to handle requests
- async stop()¶
Stop the stdio transport.