Versions in this module Expand all Collapse all v0 v0.0.3 Aug 11, 2023 v0.0.2 Aug 11, 2023 Changes in this version + const DefaultBufferSize + func ClientMaxBufferSize(s int) func(c *Client) + type Client struct + Connected bool + Connection *http.Client + EncodingBase64 bool + Headers map[string]string + LastEventID atomic.Value + ReconnectNotify backoff.Notify + ReconnectStrategy backoff.BackOff + ResponseValidator ResponseValidator + Retry time.Time + URL string + func NewClient(url string, opts ...func(c *Client)) *Client + func (c *Client) OnConnect(fn ConnCallback) + func (c *Client) OnDisconnect(fn ConnCallback) + func (c *Client) Subscribe(stream string, handler func(msg *Event)) error + func (c *Client) SubscribeChan(stream string, ch chan *Event, params ...interface{}) error + func (c *Client) SubscribeChanRaw(ch chan *Event) error + func (c *Client) SubscribeChanRawWithContext(ctx context.Context, ch chan *Event) error + func (c *Client) SubscribeChanWithContext(ctx context.Context, p interface{}, ch chan *Event) error + func (c *Client) SubscribeRaw(handler func(msg *Event)) error + func (c *Client) SubscribeRawWithContext(ctx context.Context, handler func(msg *Event)) error + func (c *Client) SubscribeWithContext(ctx context.Context, stream string, handler func(msg *Event)) error + func (c *Client) Unsubscribe(ch chan *Event) + type ConnCallback func(c *Client) + type Event struct + Comment []byte + Data []byte + Event []byte + ID []byte + Retry []byte + type EventLog []*Event + func (e *EventLog) Add(ev *Event) + func (e *EventLog) Clear() + func (e *EventLog) Replay(s *Subscriber) + type EventStreamReader struct + func NewEventStreamReader(eventStream io.Reader, maxBufferSize int) *EventStreamReader + func (e *EventStreamReader) ReadEvent() ([]byte, error) + type ResponseValidator func(c *Client, resp *http.Response) error + type Server struct + AutoReplay bool + AutoStream bool + BufferSize int + EncodeBase64 bool + EventTTL time.Duration + Headers map[string]string + OnSubscribe func(streamID string, sub *Subscriber) + OnUnsubscribe func(streamID string, sub *Subscriber) + SplitData bool + func New() *Server + func NewWithCallback(onSubscribe, onUnsubscribe func(streamID string, sub *Subscriber)) *Server + func (s *Server) Close() + func (s *Server) CreateStream(id string) *Stream + func (s *Server) Publish(id string, event *Event) + func (s *Server) RemoveStream(id string) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) StreamExists(id string) bool + func (s *Server) TryPublish(id string, event *Event) bool + type Stream struct + AutoReplay bool + Eventlog EventLog + ID string + OnSubscribe func(streamID string, sub *Subscriber) + OnUnsubscribe func(streamID string, sub *Subscriber) + type Subscriber struct + URL *url.URL