go-sse: github.com/SubChord/go-sse Index | Files | Directories

package net

import "github.com/SubChord/go-sse"

Index

Package Files

broker.go client_connection.go errors.go event.go sse_feed.go

type Broker Uses

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

func NewBroker Uses

func NewBroker(customHeaders map[string]string) *Broker

func (*Broker) Broadcast Uses

func (b *Broker) Broadcast(event Event)

func (*Broker) Close Uses

func (b *Broker) Close() error

func (*Broker) Connect Uses

func (b *Broker) Connect(clientId string, w http.ResponseWriter, r *http.Request) (*ClientConnection, error)

func (*Broker) ConnectWithHeartBeatInterval Uses

func (b *Broker) ConnectWithHeartBeatInterval(clientId string, w http.ResponseWriter, r *http.Request, interval time.Duration) (*ClientConnection, error)

func (*Broker) IsClientPresent Uses

func (b *Broker) IsClientPresent(clientId string) bool

func (*Broker) Send Uses

func (b *Broker) Send(clientId string, event Event) error

func (*Broker) SetDisconnectCallback Uses

func (b *Broker) SetDisconnectCallback(cb func(clientId string, sessionId string))

type ClientConnection Uses

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

func (*ClientConnection) Done Uses

func (c *ClientConnection) Done() <-chan interface{}

func (*ClientConnection) Id Uses

func (c *ClientConnection) Id() string

func (*ClientConnection) Send Uses

func (c *ClientConnection) Send(event Event)

func (*ClientConnection) SessionId Uses

func (c *ClientConnection) SessionId() string

type Event Uses

type Event interface {
    Prepare() []byte
    GetId() string
    GetEvent() string
    GetData() string
}

type HeartbeatEvent Uses

type HeartbeatEvent struct{}

func (HeartbeatEvent) GetData Uses

func (h HeartbeatEvent) GetData() string

func (HeartbeatEvent) GetEvent Uses

func (h HeartbeatEvent) GetEvent() string

func (HeartbeatEvent) GetId Uses

func (h HeartbeatEvent) GetId() string

func (HeartbeatEvent) Prepare Uses

func (h HeartbeatEvent) Prepare() []byte

type SSEError Uses

type SSEError struct {
    Message string
}

type SSEFeed Uses

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

func ConnectWithSSEFeed Uses

func ConnectWithSSEFeed(url string, headers map[string][]string) (*SSEFeed, error)

func (*SSEFeed) Close Uses

func (s *SSEFeed) Close()

func (*SSEFeed) Subscribe Uses

func (s *SSEFeed) Subscribe(eventType string) (*Subscription, error)

type StreamingUnsupportedError Uses

type StreamingUnsupportedError struct {
    SSEError
}

StreamingUnsupportedError

func NewStreamingUnsupportedError Uses

func NewStreamingUnsupportedError(msg string) *StreamingUnsupportedError

func (StreamingUnsupportedError) Error Uses

func (s StreamingUnsupportedError) Error() string

type StringEvent Uses

type StringEvent struct {
    Id    string
    Event string
    Data  string
}

func (StringEvent) GetData Uses

func (e StringEvent) GetData() string

func (StringEvent) GetEvent Uses

func (e StringEvent) GetEvent() string

func (StringEvent) GetId Uses

func (e StringEvent) GetId() string

func (StringEvent) Prepare Uses

func (e StringEvent) Prepare() []byte

type Subscription Uses

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

func (*Subscription) Close Uses

func (s *Subscription) Close()

func (*Subscription) ErrFeed Uses

func (s *Subscription) ErrFeed() <-chan error

func (*Subscription) EventType Uses

func (s *Subscription) EventType() string

func (*Subscription) Feed Uses

func (s *Subscription) Feed() <-chan Event

type UnknownClientError Uses

type UnknownClientError struct {
    SSEError
}

UnknownClientError

func NewUnknownClientError Uses

func NewUnknownClientError(clientId string) *UnknownClientError

func (UnknownClientError) Error Uses

func (u UnknownClientError) Error() string

Directories

PathSynopsis
example

Package net imports 10 packages (graph). Updated 2020-11-24. Refresh now. Tools for package owners.