Skip to content

feat(nip67): support EOSE completeness hints #718

Description

@Ferryx349

Context & Problem

When clients send a REQ subscription, Nostream streams the matching events and closes with an ["EOSE", <sub_id>] message. However, the client has no way to know why the stream ended. Did it end because there are no more events in the database? Or did it end because Nostream hit its internal LIMIT threshold?

Proposed Solution

Implement NIP-67 by appending a completeness hint JSON object to the EOSE message.

Scope

  • Database Layer: Modify the PostgreSQL query builder (event-repository.ts). When applying a LIMIT N, execute LIMIT N + 1. If N + 1 rows are returned, drop the last row and flag the result as completeness: "limit". Otherwise, flag as "full".
  • Streaming Pipeline: Plumb this completeness metadata through Nostream’s reactive streaming pipeline (streamMap, streamFilter, streamEnd).
  • WebSocket Handler: Modify the outgoing EOSE formatter to append {"completeness": "limit" | "full"}.

NIPs Involved: NIP-67

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions