Warp-net/warpnet

Implement Unsent Message Offline Queue

Open

#17 opened on May 20, 2025

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Go (12 forks)auto 404
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (137 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently, if a post or message is intended for a specific remote node (e.g. a subscriber or friend), but that node is offline or unreachable at the moment of delivery, the message is simply not delivered — and may be lost unless retried manually.

This is unacceptable for a reliable social system, especially in a distributed P2P environment.

Goal:

Implement a persistent message queue for posts/messages that could not be delivered because the target node was offline. These messages must be:

  • Stored in a local BadgerDB-backed queue,
  • Associated with the intended peer ID or user ID,
  • Automatically retried when the target node comes back online (i.e., discovered via libp2p peer events).

Requirements:

  1. Storage:

    • Use BadgerDB with keys like: /STREAM/offline_queue/<peerID>/<timestamp>:<nonce><serialized post>
    • Include optional metadata: retry count, original time, content type.
  2. Enqueue Logic:

    • When sending a post fails due to offline peer or timeout,
    • Immediately persist the message to the offline queue.
  3. Delivery Logic:

    • On peer online event from discovery/libp2p,
    • Check queue for that peer and flush all pending posts/messages.
    • On successful delivery, delete entry from DB.
  4. Reliability Features:

    • Retry with backoff or on reconnect,
    • TTL or garbage collection for very old messages,
    • Optional limit per peer (to prevent abuse or memory bloat).
  5. Hook into existing streamer/broadcaster system.

Without such a queue, messages/posts are lost if the recipient is temporarily offline, breaking eventual delivery guarantees and leading to fragmented user experience. This queue ensures reliability, resilience, and eventual consistency in message propagation between peers.

Looking for contributors with experience in P2P message delivery or durable queuing systems.

Contributor guide