Skip to content

hostd: TCP/WebSocket listener for companion protocol #107

@dougborg

Description

@dougborg

Summary

Add a TCP and/or WebSocket listener to hostd so companion apps can connect over the network, not just via stdin/stdout piping.

Context

Currently hostd outputs NDJSON to stdout and reads commands from stdin. This works for local piping but isn't practical for GUI companion apps or remote monitoring.

Implementation

  • Add --listen <addr:port> CLI flag (e.g., --listen 0.0.0.0:4200)
  • TCP listener using tokio::net::TcpListener
  • Each connection gets a clone of the output stream (broadcast channel) and can send commands
  • Optional WebSocket upgrade using tokio-tungstenite for browser-based companions
  • Same NDJSON protocol over TCP/WebSocket as over stdio
  • Multiple simultaneous clients

Design Decisions

  • TCP only, WebSocket only, or both?
  • mDNS/DNS-SD advertisement for auto-discovery?
  • Authentication/TLS for non-localhost connections?

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthostdHost daemon (Mac/Linux)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions