sse

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataEndpoint = "/relay/v1/data/events/realtime"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*settings)

func WithContext

func WithContext(ctx context.Context) Option

WithContext is used to provide a specific external context to the client subscription.

func WithRelay

func WithRelay(relayURL string) Option

WithRelay is used to provide the relay to connect to.

func WithSSEClientOptions

func WithSSEClientOptions(opts ...func(c *sse.Client)) Option

WithSSEClientOptions is used to customize SSE Client.

func WithTopics

func WithTopics(topics ...topics.EventType) Option

WithTopics is used to provide which topics to listen to.

type SSEClient

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

SSEClient encapsulates sse.Client and stores the topic to listen to on the Flashbots Relayer.

func New

func New(opts ...Option) (*SSEClient, error)

New creates an SSE client listening to the SSE endpoint on the provided relay. It stores the topics to listen to later on.

func (*SSEClient) Subscribe

func (c *SSEClient) Subscribe(stream string) (chan dto.Result, error)

func (*SSEClient) Unsubscribe

func (c *SSEClient) Unsubscribe()

Jump to

Keyboard shortcuts

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