Skip to content

Daemon mode for recv #7

Description

@kwsantiago

Problem

whisper recv reconnects on each invocation. For TUI or long-running scripts, this adds latency and wastes connections.

Solution

Add a daemon mode that maintains persistent relay connections:

# Start daemon (backgrounds, writes PID)
whisper daemon start

# Recv uses daemon's connection
whisper recv --via-daemon

# Stop daemon
whisper daemon stop

Implementation

  • Daemon listens on Unix socket (e.g., $XDG_RUNTIME_DIR/whisper.sock)
  • Maintains relay connections and subscriptions
  • Clients connect to socket, request messages
  • Daemon handles reconnection logic

Alternative: Simpler approach

Just add --persist flag to recv that reconnects automatically on disconnect:

whisper recv --persist  # reconnects forever until SIGTERM

This may be sufficient for most use cases without full daemon complexity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmediumModerate effortp2Medium priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions