Documentation ¶
Index ¶
- Constants
- Variables
- func HeadProcessor(ctx context.Context, payload string, repo identifiable[storage.Block]) (*responses.Block, error)
- func TxProcessor(ctx context.Context, payload string, repo identifiable[storage.Tx]) (*responses.Tx, error)
- type Channel
- type Client
- func (c *Client) ApplyFilters(msg Subscribe) error
- func (c *Client) Close() error
- func (c *Client) DetachFilters(msg Unsubscribe) error
- func (c *Client) Filters() *Filters
- func (c *Client) Id() uint64
- func (c *Client) Notify(msg any)
- func (c *Client) ReadMessages(ctx context.Context, ws *websocket.Conn, sub *Client, log echo.Logger)
- func (c *Client) WriteMessages(ctx context.Context, ws *websocket.Conn, log echo.Logger)
- type Filterable
- type Filters
- type HeadFilter
- type Manager
- type Message
- type Subscribe
- type TransactionFilters
- type TxFilter
- type Unsubscribe
Constants ¶
View Source
const ( MethodSubscribe = "subscribe" MethodUnsubscribe = "unsubscribe" )
methods
View Source
const ( ChannelHead = "head" ChannelTx = "tx" )
channels
Variables ¶
View Source
var ( ErrUnknownMethod = errors.New("unknown method") ErrUnknownChannel = errors.New("unknown channel") )
Functions ¶
func HeadProcessor ¶
Types ¶
type Channel ¶
type Channel[I, M any] struct { // contains filtered or unexported fields }
func NewChannel ¶
func NewChannel[I, M any](storageChannelName string, processor processor[I, M], repo identifiable[I], filters Filterable[M]) *Channel[I, M]
func (*Channel[I, M]) RemoveClient ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ApplyFilters ¶
func (*Client) DetachFilters ¶
func (c *Client) DetachFilters(msg Unsubscribe) error
func (*Client) ReadMessages ¶
type Filterable ¶
type HeadFilter ¶
type HeadFilter struct{}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) AddClientToChannel ¶
func (*Manager) Handle ¶
Handle godoc
@Summary Websocket API @Description.markdown websocket @Tags websocket @ID websocket @Produce json @Router /v1/ws [get]
func (*Manager) RemoveClientFromChannel ¶
type Message ¶
type Message struct { Method string `json:"method" validate:"required,oneof=subscribe,unsubscribe"` Body json.RawMessage `json:"body" validate:"required"` }
type Subscribe ¶
type Subscribe struct { Channel string `json:"channel" validate:"required,oneof=head tx"` Filters json.RawMessage `json:"filters" validate:"required"` }
type TransactionFilters ¶
type Unsubscribe ¶
type Unsubscribe struct {
Channel string `json:"channel" validate:"required,oneof=head tx"`
}
Click to show internal directories.
Click to hide internal directories.