Skip to content

improve readme #2

@melvincarvalho

Description

@melvincarvalho

just leaving this boilerplate here, not sure how accurate it is:

Hyper-Nostr Relay

Hyper-Nostr Relay is a WebSocket-based relay server for creating and managing distributed swarms using the Hyper SDK. It allows you to send and receive events in a decentralized manner with ease.

Features

  • WebSocket support for easy integration with web applications
  • Automatic creation and management of swarms with a provided topic
  • Handling of various message types like EVENT, REQ, CLOSE, and COUNT
  • Graceful shutdown using the graceful-goodbye module
  • Built-in support for the Hyper SDK

Getting Started

To get started, you can run the Hyper-Nostr Relay server with the desired port and an optional list of starting topics:

$ hyper-nostr [port] [startingTopics...]

For example:

$ hyper-nostr 3000 topic1 topic2

WebSocket API

Clients can connect to the Hyper-Nostr Relay server using WebSockets and send messages with the following structure:

  • ['EVENT', value]: Send an event with the given value
  • ['REQ', value, ...rest]: Request events matching the given filters (specified in rest)
  • ['CLOSE', value]: Close the subscription with the given value
  • ['COUNT', value, ...rest]: Request the count of events matching the given filters (specified in rest)

Upon receiving messages from clients, the server will respond with appropriate messages:

  • ['OK', eventId, true, '']: Acknowledgment of a sent event
  • ['EVENT', value, event]: Event data matching a subscription
  • ['EOSE', value]: End of a subscription's event stream
  • ['COUNT', value, { count: eventCount }]: Count of events matching the given filters
  • ['NOTICE', 'Unrecognized event']: Notification of an unrecognized event type

License

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions