stream

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Connect(environment string) error
	OnDisconnect(func() error) error
}

Connection is simple interface for streams

type Message

type Message struct {
	Event      string `json:"event"`
	Domain     string `json:"domain"`
	Identifier string `json:"identifier"`
	Version    int    `json:"version"`
}

Message is basic object for marshalling data from ff stream

type SSEClient

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

SSEClient is Server Send Event object

func NewSSEClient

func NewSSEClient(
	apiKey string,
	token string,
	client *sse.Client,
	cache cache.Cache,
	api rest.ClientWithResponsesInterface,
	logger logger.Logger,
) *SSEClient

NewSSEClient creates an object for stream interactions

func (*SSEClient) Connect

func (c *SSEClient) Connect(environment string) error

Connect will subscribe to SSE stream

func (*SSEClient) OnDisconnect

func (c *SSEClient) OnDisconnect(f func() error) error

OnDisconnect will trigger func f when stream disconnects

Jump to

Keyboard shortcuts

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