listeners

package
v1.2.37 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Unlicense Imports: 17 Imported by: 0

Documentation

Overview

Package listeners is a singleton package that keeps track of nostr websockets

Index

Constants

View Source
const (
	DefaultChallengeHRP    = "nchal"
	DefaultWriteWait       = 10 * time.Second
	DefaultPongWait        = 60 * time.Second
	DefaultPingPeriod      = DefaultPongWait / 2
	DefaultMaxMessageSize  = 1 * units.Mb
	DefaultChallengeLength = 16
)

Variables

View Source
var (
	NIP20prefixmatcher = regexp.MustCompile(`^\w+: `)
	Upgrader           = websocket.Upgrader{ReadBufferSize: 1024, WriteBufferSize: 1024,
		CheckOrigin: func(r *http.Request) bo {
			return true
		}}
)

Functions

This section is empty.

Types

type L

type L struct {
	// contains filtered or unexported fields
}

type Map

type Map map[*web.Socket]map[st]*L

type T

type T struct {
	sync.Mutex
	Map
	ChallengeHRP st
	WriteWait,
	PongWait,
	PingPeriod time.Duration
	MaxMessageSize  int64
	ChallengeLength no
}

func New

func New() (l *T)

func (*T) GetChallenge

func (l *T) GetChallenge(conn *websocket.Conn, req *http.Request,
	addr string) (ws *web.Socket)

func (*T) NotifyListeners

func (l *T) NotifyListeners(authRequired bo, ev *event.T)

func (*T) RemoveListener

func (l *T) RemoveListener(ws *web.Socket)

func (*T) RemoveListenerId

func (l *T) RemoveListenerId(ws *web.Socket, id st)

func (*T) SetListener

func (l *T) SetListener(id st, ws *web.Socket, ff *filters.T)

Jump to

Keyboard shortcuts

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