Documentation ¶
Index ¶
- Constants
- Variables
- type BlockFilter
- 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, log echo.Logger)
- func (c *Client) WriteMessages(ctx context.Context, ws *websocket.Conn, log echo.Logger)
- type ClientHandler
- type Filterable
- type Filters
- type HeadFilter
- type INotification
- type Manager
- type Message
- type Notification
- type Subscribe
- type TransactionFilters
- type Unsubscribe
Constants ¶
View Source
const ( MethodSubscribe = "subscribe" MethodUnsubscribe = "unsubscribe" )
methods
View Source
const ( ChannelHead = "head" ChannelBlocks = "blocks" )
channels
Variables ¶
View Source
var ( ErrUnknownMethod = errors.New("unknown method") ErrUnknownChannel = errors.New("unknown channel") )
Functions ¶
This section is empty.
Types ¶
type BlockFilter ¶ added in v1.4.0
type BlockFilter struct{}
func (BlockFilter) Filter ¶ added in v1.4.0
func (f BlockFilter) Filter(c client, msg Notification[*responses.Block]) bool
type Channel ¶
type Channel[I any, M INotification] struct { // contains filtered or unexported fields }
func NewChannel ¶
func NewChannel[I any, M INotification](processor processor[I, M], 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 ClientHandler ¶ added in v1.9.9
type Filterable ¶
type Filterable[M INotification] interface { Filter(c client, msg Notification[M]) bool }
type HeadFilter ¶
type HeadFilter struct{}
func (HeadFilter) Filter ¶
func (f HeadFilter) Filter(c client, msg Notification[*responses.State]) bool
type INotification ¶ added in v1.4.0
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 @x-internal true @Produce json @Router /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 Notification ¶ added in v1.4.0
type Notification[T INotification] struct { Channel string `json:"channel"` Body T `json:"body"` }
func NewBlockNotification ¶ added in v1.4.0
func NewBlockNotification(block responses.Block) Notification[*responses.Block]
func NewStateNotification ¶ added in v1.4.0
func NewStateNotification(state responses.State) Notification[*responses.State]
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.