diff --git a/subscribe_event.go b/subscribe_event.go index d42df32..6ca3f48 100644 --- a/subscribe_event.go +++ b/subscribe_event.go @@ -16,6 +16,7 @@ func (i *Client) Subscribe(ctx context.Context, events ...EventType) (<-chan Eve out := make(chan Event, 10) eventMap := slices.ToStructMap(events) + allEvents := len(events) == 0 go func() { defer r.Close() @@ -25,7 +26,7 @@ func (i *Client) Subscribe(ctx context.Context, events ...EventType) (<-chan Eve for ctx.Err() == nil && sc.Scan() { event := parseEvent(sc.Text()) - if _, ok := eventMap[event.Type]; ok { + if _, ok := eventMap[event.Type]; allEvents || ok { out <- event } }