sse

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYSSessionCreated = "Created"
)
View Source
const SYSSessionTopic = "$SYS/session"

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Topic    string `json:"topic"`
	Name     string `json:"name"`
	Data     any    `json:"data"`
	Metadata any    `json:"metadata"`
}

type Server

type Server struct {
	NewSessionHandler   func(id string, session *Session)
	CloseSessionHandler func(id string, session *Session)
	// contains filtered or unexported fields
}

func New

func New() *Server

func (*Server) Get

func (s *Server) Get(id string) (*Session, bool)

func (*Server) HandleFunc

func (s *Server) HandleFunc() httprouter.Handle

func (*Server) Sessions added in v0.8.0

func (s *Server) Sessions() map[string]*Session

type Session

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

func (*Session) Send

func (s *Session) Send(e *Event)

Jump to

Keyboard shortcuts

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