relay

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	SendMessage(msg interface{})
	GetWS() *websocket.Conn
	GetSubscriptions() map[string][]Filter
	CloseClient()
	IsConnected() bool
}

ClientInterface abstracts WebSocket clients

type Event

type Event struct {
	ID        string     `json:"id" bson:"id"`
	PubKey    string     `json:"pubkey" bson:"pubkey"`
	CreatedAt int64      `json:"created_at" bson:"created_at"`
	Kind      int        `json:"kind" bson:"kind"`
	Tags      [][]string `json:"tags" bson:"tags"`
	Content   string     `json:"content" bson:"content"`
	Sig       string     `json:"sig" bson:"sig"`
}

type Filter

type Filter struct {
	IDs     []string            `json:"ids,omitempty"`
	Authors []string            `json:"authors,omitempty"`
	Kinds   []int               `json:"kinds,omitempty"`
	Tags    map[string][]string `json:"#,omitempty"` // Fixed: should be "#" for tag filters
	Since   *time.Time          `json:"since,omitempty"`
	Until   *time.Time          `json:"until,omitempty"`
	Limit   *int                `json:"limit,omitempty"`
}

Filter represents the criteria used to query events

func (Filter) ToSubscriptionFilter added in v0.4.1

func (f Filter) ToSubscriptionFilter() map[string]interface{}

ToSubscriptionFilter converts Filter to a relay-compatible format

type Subscription

type Subscription struct {
	ID      string
	Filters []Filter
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL